Backbone - Localization
 
Loading...
Searching...
No Matches
Backbone::LocalizedMaterial Class Reference

Automatically updates the main texture of a material using a localized texture from the LocalizationManager based on the current language. More...

Inheritance diagram for Backbone::LocalizedMaterial:

Public Attributes

LocalizedTexture localizedTexture
 Localized texture definition (can use a key or inline values).
 

Private Member Functions

void Awake ()
 
void OnEnable ()
 
void OnDisable ()
 
void UpdateMaterial ()
 Updates the material's main texture using the localized texture.
 

Private Attributes

Renderer targetRenderer
 

Detailed Description

Automatically updates the main texture of a material using a localized texture from the LocalizationManager based on the current language.

This component allows you to change the visual appearance of materials dynamically in runtime, depending on the selected language.

Usage:

  1. Attach this component to a GameObject with a Renderer (e.g., MeshRenderer).
  2. Assign a LocalizedTexture in the Inspector (either via key or direct values).
  3. The material's main texture (_MainTex) will be updated when the language changes.

Example:

  • localizationKey = "screens.welcome"
  • English -> Texture EN
  • Spanish -> Texture ES

Notes:

  • This updates material.mainTexture (which creates an instance of the material).
  • Ensure your material uses _MainTex or compatible property.
  • Logs a warning if no localized texture is found.

Member Function Documentation

◆ Awake()

void Backbone::LocalizedMaterial::Awake ( )
private

◆ OnDisable()

void Backbone::LocalizedMaterial::OnDisable ( )
private

◆ OnEnable()

void Backbone::LocalizedMaterial::OnEnable ( )
private

◆ UpdateMaterial()

void Backbone::LocalizedMaterial::UpdateMaterial ( )
private

Updates the material's main texture using the localized texture.

Member Data Documentation

◆ localizedTexture

LocalizedTexture Backbone::LocalizedMaterial::localizedTexture

Localized texture definition (can use a key or inline values).

◆ targetRenderer

Renderer Backbone::LocalizedMaterial::targetRenderer
private

The documentation for this class was generated from the following file: