protected override void OnCanvasHierarchyChanged() { // Use m_Cavas so we dont auto call CacheCanvas Canvas currentCanvas = m_Canvas; CacheCanvas(); if (currentCanvas != m_Canvas) { GraphicRegistry.UnregisterGraphicForCanvas(currentCanvas, this); GraphicRegistry.RegisterGraphicForCanvas(canvas, this); } }
protected override void OnTransformParentChanged() { base.OnTransformParentChanged(); if (!IsActive()) { return; } CacheCanvas(); GraphicRegistry.RegisterGraphicForCanvas(canvas, this); SetAllDirty(); }
/// <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(); }