protected void SetDirtyCaching() { if (!IsActive()) { return; } CanvasUpdateRegistry.RegisterCanvasElementForLayoutRebuild(this); LayoutRebuilder.MarkLayoutForRebuild(rectTransform); }
protected override void OnValidate() { base.OnValidate(); Set(m_IsOn, false); PlayEffect(toggleTransition == ToggleTransition.None); var prefabType = UnityEditor.PrefabUtility.GetPrefabType(this); if (prefabType != UnityEditor.PrefabType.Prefab && !Application.isPlaying) { CanvasUpdateRegistry.RegisterCanvasElementForLayoutRebuild(this); } }
protected override void OnEnable() { base.OnEnable(); if (m_HorizontalScrollbar) { m_HorizontalScrollbar.onValueChanged.AddListener(SetHorizontalNormalizedPosition); } if (m_VerticalScrollbar) { m_VerticalScrollbar.onValueChanged.AddListener(SetVerticalNormalizedPosition); } CanvasUpdateRegistry.RegisterCanvasElementForLayoutRebuild(this); }
protected override void OnValidate() { base.OnValidate(); m_Size = Mathf.Clamp01(m_Size); //This can be invoked before OnEnabled is called. So we shouldn't be accessing other objects, before OnEnable is called. if (IsActive()) { UpdateCachedReferences(); Set(m_Value, false); // Update rects since other things might affect them even if value didn't change. UpdateVisuals(); } var prefabType = UnityEditor.PrefabUtility.GetPrefabType(this); if (prefabType != UnityEditor.PrefabType.Prefab && !Application.isPlaying) { CanvasUpdateRegistry.RegisterCanvasElementForLayoutRebuild(this); } }