using System.Collections; using System.Collections.Generic; using System.Collections.Specialized; using System.Runtime.InteropServices; using UnityEngine; public class Rocket : MonoBehaviour { Rigidbody rigidbody; // Start is called before the first frame update void Start() { rigidbody = GetComponent(); } // Update is called once per frame void Update() { ProcessInput(); } private void ProcessInput() { if (Input.GetKey(KeyCode.Space)) { rigidbody.AddRelativeForce(Vector3.up); // AddRelativeForce(Vector3.up); } if (Input.GetKey(KeyCode.A)) { print("LeftPressed"); } else if (Input.GetKey(KeyCode.D)) { print("RightPressed"); } } }