Quantcast
Channel: Unity Forum
Viewing all articles
Browse latest Browse all 1466670

Avoiding Singleton: How to design a class containing data that is used across the system.

$
0
0
Example Scenario:
I am making a tower defense game, and I have a class that contains tower data (tower type, damage, cost, range, etc.) Now, multiple classes (Upgrade System, Tower Factory, Store, etc) need access to these data. All of these are read-only.

Questions:
1. Is making a singleton class acceptable in this scenario? Why? Why not?
2. What could be a better design?

Viewing all articles
Browse latest Browse all 1466670

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>