public void invoked()
{
Object.Instantiate (gameObject, new Vector3 (0, 0.5f, -5.7f), Quaternion.identity);
}
I want to execute this method NOT more than 3 times. I am stuck here. Any solution to execute this method only 3 times??
Please reply…
public void invoked()
{
Object.Instantiate (gameObject, new Vector3 (0, 0.5f, -5.7f), Quaternion.identity);
}
I want to execute this method NOT more than 3 times. I am stuck here. Any solution to execute this method only 3 times??
Please reply…
Add a private counter variable and transform your code to something like that:
`
private int counter = 0;
public void invoked() {
if(counter >= 3)
{
return;
}
counter++;
Object.Instantiate (gameObject, new Vector3 (0, 0.5f, -5.7f), Quaternion.identity);
}
`