I have been trying for hours to get this to work and I have not come up with the answer searching either. What I am try to do in JScript:
Spawn different replacements after my enemies are destroyed. For example when it is destroyed I want an explosion to instantiate in its place and and sometimes a wreakage as well. Here is the code I am using but nothing happens after an enemy is destroyed:
#pragma strict
var hp : float;
var replacementSpawn : GameObject[];
var replacement : GameObject;
//Take Damage Function
//Subtract damage from hp
function TakeDamage( damage : float )
{
hp = hp - damage;
if(hp <= 0)
{
var i : float = 0;
while( i < replacementSpawn.Length)
{
Instantiate (replacement, replacementSpawn_.transform.position, replacementSpawn*.transform.rotation);*_
* i++;*
* }*
* Network.Destroy(gameObject);*
* }*
}