Beispiel #1
0
 public virtual void Awake()
 {
     if (dialogueUI == null)
     {
         dialogueUI = Tools.GetComponentAnywhere <TextMeshProDialogueUI>(gameObject);
     }
     if (typewriterEffect == null)
     {
         typewriterEffect = GetComponentInChildren <TextMeshProTypewriterEffect>();
     }
 }
        private void RemoveIfDuplicate()
        {
            var effects = GetComponents <TextMeshProTypewriterEffect>();

            if (effects.Length > 1)
            {
                TextMeshProTypewriterEffect keep = effects[0];
                for (int i = 1; i < effects.Length; i++)
                {
                    if (effects[i].GetInstanceID() < keep.GetInstanceID())
                    {
                        keep = effects[i];
                    }
                }
                for (int i = 0; i < effects.Length; i++)
                {
                    if (effects[i] != keep)
                    {
                        Destroy(effects[i]);
                    }
                }
            }
        }