/// <summary> /// Called after the view is loaded. /// </summary> protected override void AfterLoad() { if (IgnoreObject) { return; } base.AfterLoad(); // adjust size initially to text TextChanged(); if (IsToggleButton) { ToggleValueChanged(); } if (ImageComponent == null && BackgroundSpriteProperty.IsUndefined(this)) { // provide raycast target so transparent clicks are tracked if (GameObject?.GetComponent <RaycastTargetGraphic>() == null) { GameObject?.AddComponent <RaycastTargetGraphic>(); } } }
/// <summary> /// Called just before the view and its children are loaded. /// </summary> protected override void BeforeLoad() { if (IgnoreObject) { return; } base.BeforeLoad(); if (MaskContent) { Mask = GameObject.AddComponent <UnityEngine.UI.Mask>(); } if (ImageComponent == null) { // check if image color or sprite has binding if (BackgroundColorProperty.HasBinding(this) || BackgroundSpriteProperty.HasBinding(this) || BackgroundSprite != null) { ImageComponent = GameObject.AddComponent <UnityEngine.UI.Image>(); FastMaterialChanged(); // apply fast material if specified } } SpriteChanged(); }