Trying to load a prefab but getting null error

I created a 3d object using Blender and imported it in Unity as .blend file.

I used this object to create a prefab as described in the Prefabs page in the Unity manual. And i believe that i did that correctly because the prefab icon is blue so it contains the object.

Now, i am trying to instatiate this prefab at runtime. I have an imageTarget and i want to clone this prefab many times and show it above that imagetarget.

The error i get is “The prefab you want to instatiate is null”.

This is how i am trying to instatiate my prefab and add it as a child to the imageTarget:

GameObject imageTarget;
imageTarget = GameObject.Find("ImageTarget");

Transform marker = (Transform) Instantiate(Resources.Load("Marker"), new Vector3 (XY[0], XY[1],0), Quaternion.identity);

marker.parent = imageTarget.transform;

The script that has the above code is attached to my ImageTarget prefab.

Thanks in advance for helping!
I’ ve seen this question in the Answers section but i couldn’t find a solution.

When you drag the prefab from your assets to the hierarchy, does it show correctly ?

Actually i think i figured it out…I had placed the prefab in a folder called MyPrefab. When i renamed that folder to Resources the error gone!

Anyway, thank you and appreciated your effort!
It is great to be in a community like this one

There is another way of doing this, using the editor, adding

public GameObject marker;

and dragging the prefab in the inspector.
then you can instantiate it:

Transform myMarker = (Transform) Instantiate(marker, new Vector3 (XY[0], XY[1],0), Quaternion.identity);

Did it help you ?

Did you make sure that the Marker prefab is inside a Resources folder?