Ejemplo n.º 1
0
        /// <summary>
        /// This function is called when the object becomes enabled and active.
        /// </summary>
        protected override void OnEnable()
        {
            _initialized = false;
            SetVerticesDirty();
#if TMP_PRESENT
            if (textMeshPro)
            {
                TMPro_EventManager.TEXT_CHANGED_EVENT.Add(OnTextChanged);
            }
#endif

#if UNITY_EDITOR && TMP_PRESENT
            if (graphic && textMeshPro)
            {
                GraphicRebuildTracker.TrackGraphic(graphic);
            }
#endif

#if UNITY_5_6_OR_NEWER
            if (graphic)
            {
                AdditionalCanvasShaderChannels channels = requiredChannels;
                var canvas = graphic.canvas;
                if (canvas && (canvas.additionalShaderChannels & channels) != channels)
                {
                    Debug.LogWarningFormat(this, "Enable {1} of Canvas.additionalShaderChannels to use {0}.", GetType().Name, channels);
                }
            }
#endif
        }
Ejemplo n.º 2
0
        /// <summary>
        /// This function is called when the behaviour becomes disabled () or inactive.
        /// </summary>
        protected override void OnDisable()
        {
#if TMP_PRESENT
            TMPro_EventManager.TEXT_CHANGED_EVENT.Remove(OnTextChanged);
#endif
            SetVerticesDirty();

#if UNITY_EDITOR && TMP_PRESENT
            if (graphic && textMeshPro)
            {
                GraphicRebuildTracker.UnTrackGraphic(graphic);
            }
#endif
        }
        /// <summary>
        /// This function is called when the object becomes enabled and active.
        /// </summary>
        protected override void OnEnable()
        {
            _initialized = false;
            SetVerticesDirty();
#if !NOT_USE_TMPRO
            if (textMeshPro)
            {
                TMPro_EventManager.TEXT_CHANGED_EVENT.Add(OnTextChanged);
            }
#endif

#if UNITY_EDITOR && !NOT_USE_TMPRO
            if (graphic && textMeshPro)
            {
                GraphicRebuildTracker.TrackGraphic(graphic);
            }
#endif
        }