private void Awake() { // Setting up references. healthBar = GameObject.Find("HealthBar").GetComponent <HealthBar>(); timeBar = GameObject.Find("TimeBar").GetComponent <TimeBar>(); m_GroundCheck = transform.Find("GroundCheck"); m_CeilingCheck = transform.Find("CeilingCheck"); m_Anim = GetComponent <Animator>(); m_Rigidbody2D = GetComponent <Rigidbody2D>(); m_Collider = GetComponent <BoxCollider2D>(); m_crystals = 0; m_currentHealth = GameValues.getPlayerHealth(); m_currentTime = GameValues.getPlayerTime(); m_weapon = GameObject.Find("gun"); m_inventory = new Inventory(); // ui_Inventory.setInventory(m_inventory); playerAudio = GetComponent <AudioSource>(); healthBar.setMaxHealth(m_maxHealth); healthBar.setHealth(m_currentHealth); timeBar.setMaxTime(m_maxTime); if (GameValues.hasGun) { Instantiate(m_weapon, this.gameObject.transform.GetChild(3).position, this.gameObject.transform.GetChild(3).rotation).transform.parent = this.gameObject.transform; Destroy(m_weapon); } }