Hey all, I’m looking to instantiate a random prefab (say, one out of five possibilities) when a target is hit by a projectile. I’m not really familiar with arrays or how to use them. I have the instantiation part down, but not the randomization. Here’s what I have so far. Any help would be appreciated. Thanks!
var thePrefab : GameObject;
function Start () {
}
function OnTriggerEnter(hit:Collider) {
Destroy(gameObject);
Instantiate(thePrefab);
}
i actually like this good, its good for spawning random enemies. eric5h5 i think what he ment is to spawn prefabs randomly, and on of them will have a higher chance to be instantiated