Hi,
I have a game object that plays an animation, after the animation is done, I want to clone this object on its origin position and play another animation with the cloned one.
I know how weird unity handles easiest wished so for the moment I just wanted to do the following: Play the animation and clone the object on its old place. I absolutely do not understand, why my Unity crashes everytime I execute this code - I guess it’s because of an infinite loop but where the fuck is there an infinite loop ? o0
This is my code:
#pragma strict
var cardGeneral:GameObject;
var cardCounter:int=0;
function Awake(){
animation.Play("giveCardPlayer");
while(cardCounter<3){
createCard();
}
}
function createCard(){
Instantiate(cardGeneral,transform.position,transform.rotation);
cardCounter++;
}