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.