using UnityEngine; using System.Collections; public class P2_weapon : MonoBehaviour { // Use this for initialization void Start () { } void Update (){ if (Input.GetKeyDown("space")) transform.Translate (Vector3.right); else if (Input.GetKeyUp("space")) transform.Translate (Vector3.left); } // Update is called once per frame }