I currently have a Custom GameMode class that handles everything i need to for my game. It is powered by a DataTable (used to determine which enemies to spawn for each wave). However, i’m not sure what the best way to handle this situaton is.
I want to reuse my GameMode among my other levels as all the functionallity for Wave Spawning etc is already handled. However, each level should provide its own DataTable to tell the GameMode which waves it should spawn, as i want each level to be different.
I know i could create a new GameMode for each level and assign the DataTable refernece but to me this doesn’t seem right at all as i would have multiple copies of the same GameMode just to set a single reference. Is there another way to do this?
So what you actually need is a blueprint that exists outside of the levels and is more persistent than a game mode blueprint. This is where you will likely want to consider using the game instance blueprint, as its a singleton and persistent regardless of the loaded level. I would recommend considering having the game instance handle keeping track of the data tables, and the games mode, upon loading with the levels, should query the game instance and ask them for a reference to the appropriate data table for that level.
Yeah that makes sense. I was thinking something similar either a Master DataTable which contains each level + Wave Data Table, or have a Map on the GameMode which would essentially be the same.
I think either way, i’m going to need a master list of Levels + Data somewhere for this to work as i want.