Quantcast
Channel: Questions in topic: "error message"
Viewing all articles
Browse latest Browse all 2891

An object reference is required to access non-static member `UnityEngine.Behaviour.enabled'

$
0
0
I am trying to model acceleration, and I have a separate script for it so that once it reaches a speed (200) it cancels the acceleration. However, I have no idea why it is giving me this error? Please help, im fairly new. public class Movement : MonoBehaviour { public float movespeed = 10f; public class Accleration {} void Update () { if (Input.GetKey (KeyCode.W)) transform.Translate (Vector3.down * movespeed * Time.deltaTime); if (movespeed > 200) Acceleration.enabled = false; } } public class Acceleration : MonoBehaviour { public class Movement {} public float movespeed = 10f; void Update () { movespeed -= Time.deltaTime; } }

Viewing all articles
Browse latest Browse all 2891

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>