/// <summary> /// Clear references. /// </summary> protected override void OnDisable() { #if UNITY_EDITOR GraphicRebuildTracker.UnTrackGraphic(this); #endif GraphicRegistry.UnregisterGraphicForCanvas(canvas, this); CanvasUpdateRegistry.UnRegisterCanvasElementForRebuild(this); if (canvasRenderer != null) { canvasRenderer.Clear(); } LayoutRebuilder.MarkLayoutForRebuild(rectTransform); base.OnDisable(); }
/// <summary> /// Mark the Graphic and the canvas as having been changed. /// </summary> protected override void OnEnable() { base.OnEnable(); CacheCanvas(); GraphicRegistry.RegisterGraphicForCanvas(canvas, this); #if UNITY_EDITOR GraphicRebuildTracker.TrackGraphic(this); #endif if (s_WhiteTexture == null) { s_WhiteTexture = Texture2D.whiteTexture; } SetAllDirty(); }