Hey there all, I am back with a new system, The Debug System.
Suppose you are in the Beach, and want to go to the Forest and with all the things with you have with you, which is not persistent inbetween plays. The first way is to just unplay, open the forest and play again (if you don’t want to persist thing with you). The second way is to walk all along to the forest.
Both ways are somewhat time wasting.
So I programmed a new System called Debug System. It allows you to open up a DebugMenu, in which there is a list of all the locations (currently 10, I guess), and if you click on one, you will be quickly spawned to that location.
Thanks.
@cirocontinisio , Now I will explain the working behind it. If you press the backquote key (the key just below escape and just above tab), the script UIManager.cs listens on the input reader for that input. It then activates the DebugMenu Gameobject. (i just duplicates the settingsMenu prefab as an starting point).
Then in the UIDebug script, I have a reference to DebugConfigSO, which is a SO containing list of all the locations and a bool to check if it is debug mode.
UIDebug loops over the array of locations, and Instantiates a Prefab called Location Item. It is a button with textmeshpro setup. Then I add an OnClick listener to each button with an extra parameter, the index of the location. The I just raise an sceneLoadEvent with that LocationSO, showLoadingScreen false, fade true.
And this works as expected.
Now this will also work in the build, i.e, the released game, and we don’t want that. To tackle this, I set the isDebugMode bool to true in the EditorColdStartup, if it is. And discard any input in the InputReader, if isDebugMode is false.