- I am getting the error below appearing in my console:
error ArgumentException: The thing that you want to instantiate is null.
Unity Engine.Object.CheckNullArgument (System.Object arg,
This error is caused when you use a script to instantiate a GameObject that does not reference a prefab.
Some possible common scenarios that could lead to this error are:
- You tried to load a prefab that is not present on a Resource folder using Resources.Load() resulting in a null reference.
- You manually assigned the GameObject a value of null on your script.
You will need to assign a reference to the GameObject that you wish to instantiate via the inspector or a script.
Via the inspector:
Create reference via a script: