/// <summary> /// MonoBehaviour method called on GameObject by Unity during initialization phase. /// </summary> public void Start() { CameraWorkCar _cameraWork = gameObject.GetComponent <CameraWorkCar>(); if (_cameraWork != null) { if (photonView.IsMine) { _cameraWork.OnStartFollowing(); } } else { Debug.LogError("<Color=Red><b>Missing</b></Color> CameraWork Component on player Prefab.", this); } // Create the UI if (this.playerUiPrefab != null) { GameObject _uiGo = Instantiate(this.playerUiPrefab, GameObject.Find("Canvas").transform); if (_uiGo == null) { Debug.Log("NULL PLAYER UI!!!!"); } else { Debug.Log("PLAYER UI: " + _uiGo.name + " vs " + this.playerUiPrefab.name); _uiGo.GetComponent <CarPlayerUI>().SetTarget(this); } } else { Debug.LogWarning("<Color=Red><b>Missing</b></Color> PlayerUiPrefab reference on player Prefab.", this); } rt = GameManagerMM.Instance.boostBar.GetComponent <RectTransform>(); #if UNITY_5_4_OR_NEWER // Unity 5.4 has a new scene management. register a method to call CalledOnLevelWasLoaded. UnityEngine.SceneManagement.SceneManager.sceneLoaded += OnSceneLoaded; #endif }
/// <summary> /// MonoBehaviour method called on GameObject by Unity during initialization phase. /// </summary> public void Start() { CameraWorkCar _cameraWork = gameObject.GetComponent <CameraWorkCar>(); _cameraWork.OnStartFollowing(); // Create the UI if (this.playerUiPrefab != null) { GameObject _uiGo = Instantiate(this.playerUiPrefab); _uiGo.SendMessage("SetTarget", this, SendMessageOptions.RequireReceiver); } else { Debug.LogWarning("<Color=Red><b>Missing</b></Color> PlayerUiPrefab reference on player Prefab.", this); } #if UNITY_5_4_OR_NEWER // Unity 5.4 has a new scene management. register a method to call CalledOnLevelWasLoaded. UnityEngine.SceneManagement.SceneManager.sceneLoaded += OnSceneLoaded; #endif }