void Update() { if (Input.GetMouseButton(mouseButton)) { if (Time.time > spawnAt + 1 / spawnRate) { if (onSpawnEvent) { onSpawnEvent.Emit(); } Spawn(); spawnAt = Time.time; } } }