If you debug, you will see the error is being raised from:
void Update()
{
currentTime -= 1 * Time.deltaTime;
if (currentTime = 0)
{
OnEnemyspawn();
}
}
This is because you have written
currentTime = 0
in the
if
condition.
C# supports the usual logical conditions from mathematics:
Less than: a < b
Less than or equal to: a <= b
Greater than: a > b
Greater than or equal to: a >= b
Equal to a == b
Not Equal to: a != b
Refer:
C# If ... Else[
^]
Thus, following would work as shared in the comment by Jo_vb.net:
if (currentTime == 0)