Quantcast
Channel: Latest Questions on Unity Answers
Viewing all articles
Browse latest Browse all 171066

I keep getting the error "NullReferenceException: Object reference not set to an instance of an object RobotFollow.Update () (at Assets/Scripts/RobotFollow.js:23)"

$
0
0
For some reason I keep getting this error. Also, the same code I am about to present to you not only pertains to the question Im asking but also to another problem Im having with it. This code is meant for my enemies of the game to follow the main character (Like what a normal enemy would do -persue-). I put the first person controller as the target but they dont move whatsoever when I preview the scene. Please help! Ill supply pictures to describe the second error.![alt text][1] var target : Transform; var moveSpeed = 3; var rotationSpeed = 3; var myTransform : Transform; function Awake() { myTransform = transform; } function Start() { target = GameObject.FindWithTag("Player").tranform; } function Update(){ transform.LookAt(Vector3(target.position.x, transform.position.y, target.position.z)); myTransform.Translate(Vector3.forward * moveSpeed * Time.deltaTime); } [1]: /storage/temp/10988-problem+2.png

Viewing all articles
Browse latest Browse all 171066

Trending Articles



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