public void Terminate() { isInitialized = false; if (messageUI != null) { if (messageUI.gameObject != null) { Destroy(messageUI.gameObject); } messageUI = null; } networkManager.DisconnectMessage(); }
private void InstantiateMessageUI() { GameObject messageObj = Resources.Load("Prefabs/LooxidLinkMessage") as GameObject; if (messageObj != null) { if (Camera.main == null) { Camera mainCamera = GameObject.FindObjectOfType <Camera>(); if (mainCamera != null) { GameObject newMessageObj = Instantiate(messageObj, mainCamera.transform) as GameObject; newMessageObj.name = "LooxidLinkMessage"; messageUI = newMessageObj.GetComponent <LooxidLinkMessage>(); } } else { GameObject newMessageObj = Instantiate(messageObj, Camera.main.transform) as GameObject; newMessageObj.name = "LooxidLinkMessage"; messageUI = newMessageObj.GetComponent <LooxidLinkMessage>(); } } }