public void ConnectChat() { /*if ((player == null) && * (GameObject.Find ("Player") != null)) { * player = GameObject.Find ("Player").GetComponent<LocalPlayer> (); * }*/ if (LocalPlayer.Instace != null) { if (LocalPlayer.Instace.DataLoaded == false) { LocalPlayer.Instace.LoadPlayerData(null); } } if (ChatHandler == null && GameObject.Find("Chat-Canvas") != null) { ChatHandler = GameObject.Find("Chat-Canvas").GetComponent <GameChatHandler> (); } if (ChatHandler != null) { if (LocalPlayer.Instace.localPlayerData.dispName != null) { if ((chatIdCache == null || chatIdCache.Length == 0) && LocalPlayer.Instace.localPlayerData.dispName.Length != 0) { chatIdCache = LocalPlayer.Instace.localPlayerData.dispName; } } if (chatIdCache != null) { if (chatIdCache.Length != 0) { ChatHandler.GameChatConnect(chatIdCache); Debug.Log("connect to chat with data: " + LocalPlayer.Instace.localPlayerData.dispName + " cache: " + chatIdCache); } } } }