soof
1
I am trying to instantiate an object in the center of a scene but when score is reached nothing happens.
public Transform Prefab;
void Start () {
if (GameControl.control.stat >= 10) {
Instantiate (Prefab, new Vector3 (0, 0, 0), Quaternion.identity);
}
}
@Youri1er : By doing this, the instantiation will occur each frame.
@soof :
private bool prefabInstantiated = false ;
void Update()
{
if (GameControl.control.stat >= 10 && !prefabInstantiated ) {
Instantiate (Prefab, new Vector3 (0, 0, 0), Quaternion.identity);
prefabInstantiated = true ;
}
}
You try to instantiate in the start function, try to move the test in the update function.