I’m trying to Instatiate a Prefab by looking it up. The following code works:
var explosion: GameObject;
function update()
{
....somestuff...
var newexplosion = Instantiate (explosion, hit.point, transform.rotation);
}
This relies on me assigning the Prefab in the Editor’s Inspector. But what I really want to do is:
function update()
.... somestuff....
var newexplosion =Instantiate (GameObject.Find("Explode"),hit.point,transform.rotation);
}
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.