Unity - "How to centralize and update all Game variables?"

0

Engine: Unity (5.4.3).

Script language used: C #

Scenario: The game is divided into scenes, each scene consisting of enemies and traps, each enemy composed of their weapons, and each of these elements composed of their respective variables.

Problem: Now in the game swing step, not to become a craft work, modifying the parameters of each enemy and trap separately (or even through their respective prefabs) ... I wish to do something like:

Considerations:

  • Need to be in table format (csv, fdb, xlsx, sql);
  • Need to be "offline" as a mini-database embedded;
  • They can be assets of the Unity Asset Store that have had satisfactory use;
asked by anonymous 04.11.2016 / 12:59

1 answer

1

If you're using C #, here's an idea: Create a class in the Singleton pattern and use properties in that class. This way you can use them anywhere in the game. (It might be a static class too, but I'd use a singleton myself). You can make the "set" of the properties already update the value in the bank and the "get" already return from the bank too, which would speed up a lot, but I do not know if this can be good in your case because of performance issues, but worth the test.

    
24.12.2016 / 06:53