/// <inheritdoc /> public override void Init(GameObject host, ThemeDefinition definition) { renderer = host.GetComponent <Renderer>(); graphic = host.GetComponent <Graphic>(); base.Init(host, definition); shaderProperties = new List <ThemeStateProperty>(); foreach (var prop in StateProperties) { if (ThemeStateProperty.IsShaderPropertyType(prop.Type)) { shaderProperties.Add(prop); } } if (renderer != null) { propertyBlock = InteractableThemeShaderUtils.InitMaterialPropertyBlock(host, shaderProperties); } else if (graphic != null) { UIMaterialInstantiator.TryCreateMaterialCopy(graphic); } // Need to update reset history tracking now that property blocks are populated correctly via above code var keys = new List <ThemeStateProperty>(originalStateValues.Keys); foreach (var value in keys) { originalStateValues[value] = GetProperty(value); } }
/// <inheritdoc /> public override void Init(GameObject host, ThemeDefinition definition) { base.Init(host, definition); shaderProperties = new List <ThemeStateProperty>(); foreach (var prop in StateProperties) { if (ThemeStateProperty.IsShaderPropertyType(prop.Type)) { shaderProperties.Add(prop); } } renderer = Host.GetComponent <Renderer>(); graphic = Host.GetComponent <Graphic>(); if (renderer != null) { propertyBlock = InteractableThemeShaderUtils.InitMaterialPropertyBlock(host, shaderProperties); } else if (graphic != null) { UIMaterialInstantiator.TryCreateMaterialCopy(graphic); } }