Hello All,
I have opened a new project of a common 2D style for pratice.
However, I have been stucked on some problems,
Please feel free to give help hand if possible.
- This is one of the them.I have three prefabs and want to non stop rolling one by one. But I cannot…
(I drag the following script on the object which I clicked will have animation play and disappear, however, it disappeared, but no new object come out from another pre-set object.)
var panelA :GameObject;
var buck : int=1;
var prefabs : GameObject[];
var instance : GameObject;
function OnClick(){
animation.Play();
Scoreboard.Score = Scoreboard.Score + buck;
panelA.active=false;
instance.Instantiate(prefabs[Random.Range(0,prefabs.length)]);
Debug.Log("clicked");
}
- Can anyone please give some hints or direction, is there a way that the prefab can be re-use( brand new ) after used once? Cuz you can see on the script, Animation of the object was played, I tried animation.Rewind(), but there is no reaction at all.
I am not lazy guy, I have really checked and try much before asking question,as I am very new in code, so PLEASE give a help hand, thx.
Yan