I’ve been working with Unity for a while now and this is the one thing I just can’t seem to grasp.
Take a gigantic game like Skyrim for example, where every NPC is basically its own class with hundreds of lines of code. How in the world do you save all the information about every single NPC?
I mean little things like:
- Which dialogue options have already been chosen
- What the NPC should say in various situations
- How the NPC reacts to the player
The thing is that I really don’t understand the concept of “everything gets deleted when another scene loads”. If I use a Gameobject with DontDestroyOnLoad as a GameManager, it would be nearly impossible to manage the entire game just in that one object. Just having like 100 complex NPCs would bloat that one object so much that I couldn’t possible hope to save everything in just one single file, right?
Furthermore - if I use a single GameManager, that means I would need to “drag” everything from every scene into every other scene. All the information about whether I already chose dialogue option 1 with an NPC from the beginning of the game would be dragged around the rest of the game. This surely can’t be right, can it?
Every time I see this question asked the answer is “use PlayerPrefs” or “use DontDestroyOnLoad”. Yeah, sure, maybe if the only thing you want to save is the player level, HP and so on. But I want to see someone manage the rest of the game just with PlayerPrefs. Are you planning on creating 100.000 variables for that and save them in what’s basically a text file?
When I used RPG Maker I’d just change a switch from off to on. And that was that. The NPC then had that new state for the rest of the game. But in Unity everything gets deleted, so how do you manage things like these?