I have a strange situation that I have been unable to track down thus far. I have 4 levels in my game and they each have Pause Global Waves checked on for the last spawner when it completes. The first 3 complete properly and waves are paused until I call the UnPause function. However, for some unknown reason I am getting the fourth level/wave 1 to start before I call the UnPause function. I received both the WaveStarted and LevelStarted callback events before I call UnPause. The interesting thing, though, is that the Level and Wave don't actually start. There is some time that passes while my game goes through the cutscene and other code before eventually getting to my code that calls UnPause. So when UnPause is finally called, it starts the level and wave at the correct time.
Now, you might think that it's a non-issue then because it technically doesn't start until I call UnPause, but I am reliant upon the LevelStarted callback to perform some important tasks. Also, because it gets LevelStarted early, I'm advancing my level number and then at some point it is thinking it is at the 5th level instead of 4th level and since there isn't a 5th level yet then things go bad.
I don't know whether this is an issue I've created myself somehow, but I can't see anything different between the previous levels that work and this one that doesn't. I'm hoping you might have some thoughts as to how this could possibly called LevelStarted/WaveStarted before I call UnPause.
Post by DarkTonic Dev on Apr 19, 2019 19:03:38 GMT
Yeah I have no idea. That sounds weird. If you can reproduce this issue in one of my example scenes and send it over I can figure it out. I doubt you want to send me the whole Scene from your game, but if that's ok, do that.
Yeah, I don't think I could send my whole scene. I can try to reproduce in an example scene, but I don't know. It's probably going to take quite a lot of effort to do that and I don't know if I could even reproduce it. It only seems to happen with one level transition. I'll see if I can put some debug into Core GameKit and see why it might be happening. If I find anything out I'll let you know.
I'm still looking at this, but after turning logging on, I get the following results at the end of the stage that is having the issue.
Firing Custom Event: StageComplete Waves paused! Starting matching wave from spawner: Loopers-LeftLooping-L4W1, wave# 1, level 4. Starting wave from triggered spawner: _AsteroidSpawner, event: CodeTriggered1. Starting matching wave from spawner: Loopers-RightLooping-L4W1, wave# 1, level 4. Level up - new level# is: 4 . Wave 1 starting, occurred at time: 198.3638
and later on when I actually call UnPause:
So, somehow even after it says that the waves are paused it goes right into starting the next wave. And my own debug shows that I get into LevelStarted and WaveStarted function callbacks before the UnPause takes place. I will see if I can figure out why it starts those waves even when it says it's paused.
Even stranger. As soon as I added in my Boss wave to the level then it no longer has the issue. When I defeat the boss, it pauses correctly and lets me move on to the next level normally. I have no idea why, but at least it's fixed for now.