public void Awake() { if (Instance != null && Instance != this) { Debug.Log("Bye Bye instance"); Destroy(Instance.gameObject); } Instance = this; //shitty singleton, but anything more ruins everything for whatever reason. // I'm not even mad rn. _nameText = transform.Find("Name").GetComponent<Text>(); _shipsButton = transform.Find("ShipsButton").GetComponent<Button>(); _shipsButton.onClick.AddListener(() => ShowShipMenu()); _viewSystemButton = transform.Find("ViewSystemButton").GetComponent<Button>(); _viewSystemButton.onClick.AddListener(() => EnterSystem()); gameObject.SetActive(false); }
void Awake() { if (manager == null) { manager = this; } GlobalGreenBall = Instantiate(GreenBallObj, Vector3.zero, Quaternion.identity); player = GameObject.FindGameObjectWithTag("Player").GetComponent <Asderek>(); pause = gameObject.GetComponentInChildren <PauseMenu>(); hp = gameObject.GetComponentInChildren <BarDisplay>(); weapon = gameObject.GetComponentInChildren <Weapons>(); ability = gameObject.GetComponentInChildren <Ability>(); interaction = gameObject.GetComponentInChildren <Interaction>(); beastiary = gameObject.GetComponentInChildren <Beastiary>(); progress = gameObject.GetComponentInChildren <Progress>(); buttonManager = gameObject.GetComponentInChildren <ButtonManager>(); warp = gameObject.GetComponentInChildren <Warp>(); start = gameObject.GetComponentInChildren <StarMenu>(); }