void Awake() { _Instance = this; // assign references if (_HUDNavigationCanvas == null) { _HUDNavigationCanvas = HUDNavigationCanvas.Instance; // check if HUDNavigationCanvas exists if (_HUDNavigationCanvas == null) { Debug.LogError("HUDNavigationCanvas not found in scene!"); this.enabled = false; return; } } // assign references if (PlayerCamera == null && Camera.main != null) { PlayerCamera = Camera.main; } // check references if (PlayerCamera == null || PlayerController == null) { Debug.LogError("Player references are missing! Please assign them on the HUDNavigationSystem component."); this.enabled = false; return; } // init all components InitAllComponents(); }
void StartQuickSetup() { if (goPlayer == null || goCamera == null) { return; } // add hud navigation system to player HUDNavigationSystem hudSystem = goPlayer.GetComponent <HUDNavigationSystem> (); if (hudSystem == null) { hudSystem = goPlayer.AddComponent <HUDNavigationSystem> (); } // assign references hudSystem.PlayerController = goPlayer.transform; hudSystem.PlayerCamera = goCamera; // add hud navigation canvas to scene HUDNavigationCanvas hudCanvas = GameObject.FindObjectOfType <HUDNavigationCanvas> (); if (hudCanvas == null) { // add canvas prefab from assets to scene GameObject hudPrefab = Resources.Load("Prefabs/HUD Navigation Canvas") as GameObject; if (hudPrefab != null) { GameObject hudGO = Instantiate(hudPrefab) as GameObject; hudGO.name = "HUD Navigation Canvas"; } } // console output Debug.LogFormat("'{0}' was successfully added to the scene.", HNS.Name); // close editor window window.Close(); }
void Awake() { _Instance = this; }