void OnDestroy() { if (mSingleton == this) { mSingleton = null; } }
static void Init() { if (mSingleton != null) { Destroy(mSingleton); mSingleton = null; } }
void Awake() { if (mSingleton == null) { mSingleton = this; DontDestroyOnLoad(gameObject); } else if (mSingleton != this) { Destroy(gameObject); } }
protected void OnDisable() { TextAnimationsManager.UnregisterAnimation(this); #if I2_NGUI OnDisableNGUI(); #endif #if I2_TMPro OnDisableTMPro(); #endif OnDisableUGUI(); // If component was disabled, but not the GO, then retrieve the old material and recreate the vertices if (gameObject.activeSelf) { MarkWidgetAsChanged(true, true); } }
[NonSerialized][XmlIgnore] public int mNumElements; // Num elements in the TextAnimation component (used to know when the InitTime should be executed again if the text changes) #endregion public void Play(TextAnimation se) { if (se != null) { if (!se.mPlayingAnimations.Contains(this)) { se.mPlayingAnimations.Add(this); TextAnimationsManager.RegisterAnimation(se); } se.MarkWidgetAsChanged(); _OnFinished += (anim) => { se._OnAnimation_Finished.Invoke(anim); }; } IsPlaying = true; mTime = mRealTime = 0; mNumElements = -1; mRandomSeed = -1; InitTimes(se, true); }