コード例 #1
0
ファイル: TText.cs プロジェクト: l2xin/CommonUtils
        public override void OnRebuildRequested()
        {
            // After a Font asset gets re-imported the managed side gets deleted and recreated,
            // that means the delegates are not persisted.
            // so we need to properly enforce a consistent state here.
            TFontUpdateTracker.UntrackText(this);
            TFontUpdateTracker.TrackText(this);

            // Also the textgenerator is no longer valid.
            cachedTextGenerator.Invalidate();

            base.OnRebuildRequested();
        }
コード例 #2
0
ファイル: TText.cs プロジェクト: l2xin/CommonUtils
        // The Text inspector editor can change the font, and we need a way to track changes so that we get the appropriate rebuild callbacks
        // We can intercept changes in OnValidate, and keep track of the previous font reference
        protected override void OnValidate()
        {
            if (!IsActive())
            {
                base.OnValidate();
                return;
            }

            if (m_FontData.font != m_LastTrackedFont)
            {
                Font newFont = m_FontData.font;
                m_FontData.font = m_LastTrackedFont;
                TFontUpdateTracker.UntrackText(this);
                m_FontData.font = newFont;
                TFontUpdateTracker.TrackText(this);

                m_LastTrackedFont = newFont;
            }
            base.OnValidate();
        }
コード例 #3
0
ファイル: TText.cs プロジェクト: l2xin/CommonUtils
 protected override void OnDisable()
 {
     TFontUpdateTracker.UntrackText(this);
     base.OnDisable();
 }
コード例 #4
0
ファイル: TText.cs プロジェクト: l2xin/CommonUtils
 protected override void OnEnable()
 {
     base.OnEnable();
     cachedTextGenerator.Invalidate();
     TFontUpdateTracker.TrackText(this);
 }