Question by
letsgamble92 · Sep 30, 2018 at 03:30 PM ·
player
Check & Spawn doesn't work after the game starts
Hello there, I have the first problem with C#
CheckOnOff is supposed to check in UIManager script if the game (gameplay) is on, or not. If it's on, it spawns player, enemies and powerups. If I put it in Update, then it spawn multiple times, if I put it in anywhere else, it doesn't work.
private void CheckOnOff()
{
_CheckOnOff = Canvas.GetComponent<UIManager>();
if (_CheckOnOff.gameplay == true)
{
PlayerSpawnRoutine();
StartCoroutine(EnemyShipSpawnRoutine());
StartCoroutine(PowerUpSpawnRoutine());
}
}
Comment
Answer by Skokon · Sep 30, 2018 at 04:28 PM
You have to put it in start void like this way
private void Start()
{
CheckOnOff();
}