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

"The referenced script on this behavior is missing!" in Roll-a-ball tutorial.

$
0
0
Hello, I'm new to unity(5) The roll-a-ball tutorial (https://unity3d.com/learn/tutorials/projects/roll-ball-tutorial) (step 2) requires code in C# fallowing the tutorial we obtain the fallowing code: using UnityEngine; using System.Collections; public class PlayerController : MonoBehaviour { private Rigidbody rb; void Start () { rb = GetComponent(); } void FixedUpdate () { float moveHorizontal = Input.GetAxis ("Horizontal"); float moveVertical = Input.GetAxis ("Vertical"); Vector3 movement = new Vector3 (moveHorizontal, 0.0f, moveVertical); rb.AddForce (movement); } } In the tutorial the sphere moves, when I hit the play button in editor I remain in same position (0,0.5,0) and I get the fallowing error: "The referenced script on this behavior is missing!" twice. After some searching from this source(http://answers.unity3d.com/questions/173352/move-a-ball-using-keybored.html) I've tried the fallowing: using UnityEngine; using System.Collections; public class PlayerController : MonoBehaviour { public int speed = 5; void FixedUpdate () { float x = Input.GetAxis("Horizontal"); float z = Input.GetAxis("Vertical"); transform.Translate(x, 0.0f, z); } } But got the same error "*The referenced script on this behavior is missing!*" twice **Is there something wrong with the code? Am I missing something?**

Viewing all articles
Browse latest Browse all 2891

Trending Articles



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