I would like to reuse a prefab by changing the script attached on the prefab.
And then instantiate it every second.
While I find that I have difficulty on passing the edited model to a function.
public void rowShooting(string modelToBeClone){
GameObject gameBackground=GameObject.Find ("Plane");
GameObject charA=(GameObject)Resources.Load("char_A");
Vector3 startPos = new Vector3 ((gameBackground.renderer.bounds.max.x+gameBackground.renderer.bounds.min.x)/2,1,6);
GameObject cloneChar= (GameObject)Instantiate (charA);
Destroy (cloneChar.GetComponent<characterAbility_A>());
cloneChar.AddComponent ("attFunction_rowAttack");
cloneModelOnRow (cloneChar,startPos);
}
public IEnumerator cloneModelOnRow(GameObject model,Vector3 center){
for(int i=0;i<5;i++){
//instaniate model
yield return new WaitForSeconds (1);
}
}
I would like to change the script on the first function,
and pass it to the second function,
while once I called the function Instantiate(),
the model have put on to the scene,
are there any solution so that I can put the model on scene in the second function?