// Update is called once per frame void Update() { //Attack if (Input.GetMouseButtonDown(0) && equipped != null && equipped.GetComponent <MeleeWeapon>() != null) { MeleeWeapon w = equipped.GetComponent <MeleeWeapon>(); w.activate(); //if (!w.isActive) { w.activate(); } } //Unequip if (Input.GetMouseButtonDown(1) && equipped != null) { equipped.transform.parent = null; GrabableObject go = equipped.GetComponent <GrabableObject>(); go.owner = null; go.reset_y_position(); equipped.transform.localRotation = Quaternion.identity; equipped = null; anim.SetBool("isHolding", false); //play sound TempSoundPlayer sp = (Instantiate(Resources.Load("TempSoundPlayer"), transform.position, transform.rotation) as GameObject).GetComponent <TempSoundPlayer>(); sp.setVolume(0.2f); sp.playSound(drop_sound); } }