I'm trying to Instatiate a Prefab by looking it up. The following code works:
This relies on me assigning the Prefab in the Editor's Inspector. But what I really want to do is:
This doesnt work unless I have an instance of the prefab Explode called "Explode".
Hence, what I want is to instatiate an object using the prefab's name.
Its no doubt a very newb question but I just cant seem to get it.
asked Oct 31 '11 at 11:05 PM
You need to load the resource and then instantiate that reference:
Note this will only load assets stored in the resources folder .. also I've noticed that the resource database might not have a link to your prefab (if you just created it) so I suggest adding this line initially:
answered Oct 31 '11 at 11:25 PM