Hi, I write a game based on Unity 3.x… and i have a problem with mini game in coconut shy. I win a power cell but i can’t take it. I think that this script doesn’t duplicate object with script attached to him.
static var targets : int = 0;
static var haveWon : boolean = false;
var winSound : AudioClip;
var cellPrefab : GameObject;
function Start () {
}
function Update () {
if(targets==3 &&haveWon == false){
targets=0;
audio.PlayOneShot(winSound);
winCell : GameObject = transform.Find("powerCell").gameObject;
winCell.transform.Translate(-1,0,0);
Instantiate(cellPrefab, winCell.transform.position, transform.rotation);
Destroy(winCell);
haveWon = true;
}
}
How in diffrent way I can add script to power cell witch I win?