// Update is called once per frame void Update() { float inputX = Input.GetAxis("Horizontal"); float inputY = Input.GetAxis("Vertical"); movement = new Vector2( speed.x * inputX, speed.y * inputY ); bool shoot = Input.GetButtonDown("Fire1"); shoot |= Input.GetButtonDown("Fire2"); if (shoot) { WeaponScript weapon = GetComponent <WeaponScript>(); if (weapon != null) { weapon.Attach(false); } } }