There is a code from which I had to transfer several variables due to the fact that they are in the Update method called every frame, and they were reset to their original value, so that they would not be done. Is logical.
using UnityEngine; using System.Collections; public class controller : MonoBehaviour { public void Start () { int thrust = 0; //changeable bool boost = false; float speed = 0f; //m/s } public static void Update () { // variable declaration int maxspd = 55; //} int boosted = 90; //} m/s^2 float accel = 13f;//} int boostacc = 16;//} Vector3 SPD; Vector3 TRANSLUP = new Vector3 (0, 0, -1); Vector3 TRANSLRIGHT = new Vector3 (0, 1, 0); Vector3 ROTUP = new Vector3 (0, 1, 0); Vector3 ROTAXIS = new Vector3 (1, 0, 0); // thrust changing and boost if(Input.GetAxis ("Mouse ScrollWheel") < 0){ Debug.Log(thrust + ", SCR U"); if(thrust < 10){ Debug.Log(thrust + ", UP"); thrust++; } }if(Input.GetAxis ("Mouse ScrollWheel") > 0){ Debug.Log(thrust + ", SCR D"); if(thrust > 0){ Debug.Log(thrust + ", DOWN"); thrust--; } } if(Input.GetMouseButton(2)){ // 2 = MMB boost = true; }else{ boost = false; } // acceleration and physics if(thrust != 0 && speed < maxspd){ speed += accel * Time.deltaTime; SPD = new Vector3 (-speed, 0, 0); transform.Translate(SPD); } if(thrust == 0 && speed > 0 && boost == false){ //assume braking speed += 20 * Time.deltaTime; SPD = new Vector3 (speed, 0, 0); transform.Translate(SPD); } // translation if(Input.GetKey("w")){ transform.Translate(TRANSLUP); } if(Input.GetKey("a")){ transform.Translate(-TRANSLRIGHT); } if(Input.GetKey("s")){ transform.Translate(-TRANSLUP); } if(Input.GetKey("d")){ transform.Translate(TRANSLRIGHT); } // controls rotation if(Input.GetKey("e")){ transform.Rotate(ROTAXIS); } if(Input.GetKey("q")){ transform.Rotate(-ROTAXIS); } if(Input.GetKey("f")){ transform.Rotate(ROTUP); } if(Input.GetKey("c")){ transform.Rotate(-ROTUP); } } } And here is the problem: I cannot create a variable in the Update method for the above reasons, but I cannot create them in the Start method, because then using them in the Update method will become impossible. Wildly I apologize for inaccuracies and such stupid questions, and it is possible that this is a duplicate.