Hi ! I have finished creating the level loader for my project but I am kinda confused about how could I keep a consistent list of my levels.
I am currently using a state machine to switch between levels, and a parent level-loader class that tracks dynamically every “level” state I add to it and store them in an exported dictionary. Then I pair the according level PackedScene file path to each “level” key in the inspector.
The problem is : I don’t know how to access this list from unrelated classes (let’s say a door that would lead to one of the levels and display a ui screen nearby displaying the level name for example). My goal would be to have a dropdown dynamic list in the inspector for that door to choose which level it leads to and a relevant description that could be easily edited by writers.
I am almost certain I could use a resource instead of a node class to store these informations, but how to keep that dynamic enough so that every time I add a new level to the state machine, the resource updates itself accordingly ?
My constraint is to avoid duplicating any data across the game.
I am thinking to switch my primary source of data from the states to a simple custom “level” resource that could be accessed by all classes in the game, whenever need and that I could painlessly expand afterwards. Any advice on that matter would still be highly appreciated ! (I really suck at using resources and i am afraid to do so)
Great ! I think I’ll go with a generic “GameLevel” resource, but your approach seems pretty consistent to populate levels. I am a bit cautious with arbitrary naming conventions because we’ll be several people to work on the game (mostly non-devs) and I guess it could lead to bug pretty quickly if someone doesn’t respect the convention.