magique
Full Member
 
Posts: 194
Posts: 194
|
Post by magique on Jan 1, 2018 19:08:47 GMT
I've seen this issue for a while, but just never got around to reporting it. I might be doing something wrong, but I just can't see what it is. In some cases when I set a Custom Start Wave, it complains with the following error when I run the game: Illegal Start Wave# specified in Level Settings. Level 3 only has 0 wave(s). Aborting. UnityEngine.Debug:LogError(Object) DarkTonic.CoreGameKit.LevelSettings:LogIfNew(String, Boolean) (at Assets/Plugins/DarkTonic/CoreGameKit/Scripts/Level/LevelSettings.cs:1229) DarkTonic.CoreGameKit.LevelSettings:CheckForValidVariables() (at Assets/Plugins/DarkTonic/CoreGameKit/Scripts/Level/LevelSettings.cs:481) DarkTonic.CoreGameKit.LevelSettings:Start() (at Assets/Plugins/DarkTonic/CoreGameKit/Scripts/Level/LevelSettings.cs:444) In this case, I've set custom start wave to Level 3 Wave 1. If I look at LevelSettings for Level 3 Wave 1 in the editor it shows that there is 1 wave and 2 spawners set up. See image below: 
|
|
magique
Full Member
 
Posts: 194
Posts: 194
|
Post by magique on Jan 1, 2018 19:14:56 GMT
Quick update. If I add a second wave to Level 3 then it doesn't complain. So, it seems to happen only when you have a single wave in a level.
|
|
|
Post by DarkTonic Dev on Jan 1, 2018 23:52:18 GMT
I could only get that to happen if you have Custom Start Wave to set something that doesn't exist, i.e. Level 3, Wave 2 when you only have 1 wave. Take a look at your Custom Start Wave settings. If it's not illegal then let me know how to reproduce, because I couldn't.
|
|
magique
Full Member
 
Posts: 194
Posts: 194
|
Post by magique on Jan 1, 2018 23:54:00 GMT
I have it set to the correct setting of Level 3 Wave 1 and it definitely existed. I've gotten around it by just adding another wave so I'm OK for now. But it definitely happens for no apparent reason. If I have time to debug it in the code then I'll let you know what I find.
|
|
|
Post by DarkTonic Dev on Jan 1, 2018 23:59:52 GMT
I tried it with Level 2, wave#1 and both a spawner using that wave and not using, but no dice here.
|
|
magique
Full Member
 
Posts: 194
Posts: 194
|
Post by magique on Jan 2, 2018 0:05:58 GMT
No idea then. But I've seen this several times during development. And every time I've verified the Level and Wave exists and has spawners. It just makes no sense.
|
|
|
Post by DarkTonic Dev on Jan 2, 2018 0:42:53 GMT
Next time you see it happen go to debug mode in the Inspector and see if the variable "startWaveNumber" is set to something different that what's being displayed. I can only imagine that I have code that sets it to the max wave but maybe doesn't save it in some cases?
Otherwise no idea either.
|
|
magique
Full Member
 
Posts: 194
Posts: 194
|
Post by magique on Jan 13, 2018 18:43:18 GMT
|
|
magique
Full Member
 
Posts: 194
Posts: 194
|
Post by magique on Jan 13, 2018 19:02:22 GMT
As I look at the code, you are performing the following calculation for wave count:
var waveCount = _waveSettingsByLevel[startLevelNum - 1].Count - 1; // -1 for the fake final wave
So, if there is only one wave then it's counting it as 0 waves. This would explain the issue.
|
|
|
Post by DarkTonic Dev on Jan 13, 2018 22:06:09 GMT
There is a final fake wave that it creates in Awake so it can finish some code in CoUpdate, so that's not the problem.
Screen shot shows nothing out of the ordinary, and I couldn't reproduce the problem, so unless you have a package to send me, this cannot be fixed.
Must be a really rare edge case that doesn't happen for me.
Do you have a level 4 or is 3 the last level?
|
|
magique
Full Member
 
Posts: 194
Posts: 194
|
Post by magique on Jan 13, 2018 22:13:23 GMT
It's definitely the problem. If I get rid of the -1 calculation then it works. So whatever this fake wave is, it doesn't seem to exist because the wave count is 0 when that calculation runs.
|
|
magique
Full Member
 
Posts: 194
Posts: 194
|
Post by magique on Jan 13, 2018 22:13:52 GMT
I have a level 4 so it's not the last level.
|
|
|
Post by DarkTonic Dev on Jan 13, 2018 22:14:27 GMT
Ok that's why...I may be able to reproduce...I'll post back here later.
|
|
magique
Full Member
 
Posts: 194
Posts: 194
|
Post by magique on Jan 13, 2018 22:16:16 GMT
It's line 479 and I definitely have a Level 4 with one wave in it. So, since the fake wave is only created on the last level then this makes sense. Level 3 has a single wave and your calculation subtracts 1 so it thinks it has 0 waves.
|
|
|
Post by DarkTonic Dev on Jan 13, 2018 23:22:18 GMT
Here's the fix. Replace that line with these.
var waveCount = _waveSettingsByLevel[startLevelNum - 1].Count; if (startLevelNum == LevelTimes.Count) { waveCount--; // -1 for the fake final wave on the final level }
|
|