prefab null not instantiated: simple example not working?

Hi,

i can’t instantiate my prefab, i read through the topics in the forum but i did not find any solution. Here is what i did :

-add a plane and a character to the scene,
-put them in an empty in “Hierarchy”.
-Then, i created a prefab in Project, and i dragged and dropped the empty into this prefab.
-I then removed the empty from Hierarchy, and attached this script to the main camera :

function Start () {
	//var instance : GameObject = Instantiate(Resources.Load("Prefabs/total", GameObject));
	//var instance : GameObject = Instantiate(Resources.Load("total", GameObject));
	var instance : GameObject = Instantiate(Resources.Load("total"));
	
	//instance.transform.position = Vector3.zero;
}

function Update () {
	
}

But i have this error :

ArgumentException: The thing you want to instantiate is null.
UnityEngine.Object.CheckNullArgument (System.Object arg, System.String message)
UnityEngine.Object.Instantiate (UnityEngine.Object original)

I tried to put the prefab in a folder, or just in “Project”, but i have got the same result.

Any idea?

Thanks

Place the prefab, that you are trying to instantiate, inside a folder called Resources not Prefabs.

Here’s a link:
Resources.load

For me, the issue was accidental and pretty stupid. I had applied the script to the object I wanted to do the instantiating, and then I also had it applied (not sure how or why… autopilot?) to the object that I wanted to instantiate.

So A was going to instantiate B, but on A I had the instantiate script, and I had it on B as well.
The simple fix was:
A was going to instantiate B. B was not going to instantiate another B, so B did not have the script. Only A had the instantiate script.