Unity Car Tutorial Error

Hello, I followed the Unity Car Tutorial and instead of the car I added my own model. It gave some errors when I ran it:

Error 1: NullReferenceException: Object reference not set to an instance of an object Car.CalculateState () (at Assets/Scripts/JavaScripts/Car.js:502) Car.FixedUpdate () (at Assets/Scripts/JavaScripts/Car.js:105)

Error 2: NullReferenceException: Object reference not set to an instance of an object Car.UpdateWheelGraphics (Vector3 relativeVelocity) (at Assets/Scripts/JavaScripts/Car.js:323) Car.Update () (at Assets/Scripts/JavaScripts/Car.js:95)

The actual car tutorial ran properly. I couldn’t figure out the problem. Any solution would be greatly appreciated.

Could you provide the code relevant to those errors?

Sure, The script is the Car.js in the Unity Car Tutorial.

It's at: http://unity3d.com/support/resources/tutorials/car-tutorial

1 Answer

1

instead of the car I added my own model

You ‘own’ model must follow the same object hierarchy of your have to modify the scripts to follow yours.