Quantcast
Channel: Questions in topic: "javascipt"
Viewing all articles
Browse latest Browse all 1875

Did something change in Unity 5 that makes this not work?

$
0
0
I'm having a problem trying to get a game object to move to the location of my mouse pointer when I click. I used the script located at http://docs.unity3d.com/Manual/nav-MoveToClickPoint.html I'm working in JavaScript and I copy and pasted the exact script. I can launch Play mode but when I click anywhere to move the object, I get an error that says NullReferenceException: Object referenced not set to an instance of an object. It says it's on line 13, which is this: if (Physics.Raycast(Camera.main.ScreenPointToRay(Input.mousePosition), hit, 100)) I created a nav mesh, baked it, put a NavAgent component on my game object, and still nothing. I'm not sure why, but does someone know if the key words have changed or something?

Viewing all articles
Browse latest Browse all 1875

Trending Articles



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