I have a Game Object called 'car' in my Assets folder. I have this code in C# unity to instantiate it.
GameObject car;
void Start () {
Vector3 position = new Vector3(5, 5, 5);
GameObject newGameObject = Instantiate(car);
newGameObject.transform.position = position;
}
And I get this error - 'the thing you want to instantiate is null'
What might be the problem ?
null
.. socar
is null.. you need to assign something tocar
? (Drag your asset to the car property in the inspector) \$\endgroup\$