// Start is called before the first frame update
 private void Awake()
 {
     if (Instance == null)
     {
         Instance = this;
     }
     else
     {
         Destroy(this);
     }
 }
Esempio n. 2
0
        public PlayerChatManager()
        {
            if (chatLog == null)
            {
                chatLog = new GameObject().AddComponent <PlayerChatLog>();
            }

            if (chatEntry == null)
            {
                chatEntry = new GameObject().AddComponent <PlayerChatEntry>();
            }
        }
Esempio n. 3
0
 // Start is called before the first frame update
 private void Awake()
 {
     if (Instance == null)
     {
         Instance    = this;
         _scrollRect = GetComponent <ScrollRect>();
     }
     else
     {
         Destroy(this);
     }
 }
Esempio n. 4
0
        public PlayerChat()
        {
            if (instance != null)
            {
                throw new Exception($"There must only be one {nameof(PlayerChat)} instance.");
            }
            instance = this;

            chatLog            = new GameObject().AddComponent <PlayerChatLog>();
            chatLog.Manager    = this;
            inputField         = new GameObject().AddComponent <PlayerChatInputField>();
            inputField.Manager = this;
        }