- Home /
How to initialise another 'game mode' on click?
So, i've got like a game where you can kill monsters and get loot etc. Pretty basic. But, when getting at your home, you'll be able to create potions with the loot you got from monsters. I have my game in one whole scene. So switching to the potion creating mode will be in the same scene. How will i disable all potion creating functions until you click the table or how exactly would i do that, because i don't want all these scripts and animations loaded at the start of the game, because they don't have to be loaded until you actually need them. Thanks in advance. :)
Answer by JVene · Aug 09, 2018 at 04:01 AM
You're asking for a large scale design treatise, which could be a book by itself. Without any code to start with, the question may end up getting removed (I see that now and then). That said, scripts aren't loaded in the manner you imagine. Depending on the operating system, code is loaded from a virtual memory system upon access, so even code you might think is loaded by not yet used is probably not "loaded" in the sense you're thinking. Put another way, you have little control over "unloading" code, certainly not by a scene oriented granularity. The closest thing to what you're thinking is the instantiation of the objects themselves, but that is about data, not code. You can create a 'manager' of sorts which loads animations from resources during runtime, but there again you're in for a study, some tutorials, and experimentation. If you're asking a general question at the beginning of your design strategy, it seems clear the answer will be that study.
Your answer
Follow this Question
Related Questions
Initialising List array for use in a custom Editor 1 Answer
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
Checking for objects and adding to array 1 Answer
Dictionary in second script empty 1 Answer