- Edited
Hi, It is not a best practice to put all preload in singeton?
In order to have all string path in one place?
what are pro and cond to do such practice?
Thanks
Hi, It is not a best practice to put all preload in singeton?
In order to have all string path in one place?
what are pro and cond to do such practice?
Thanks
Hi Vale-git,
Putting preloads in a singleton is not something I'd do, but in my opinion the ultimate test regarding whether or not something is "best practice" is whether or not it works well enough for you. If putting all preload string paths in a singleton helps you create what you want to create, then do that.
That being said, you might consider using "load" rather than "preload" and making some sort of system that manages when and how assets get loaded so it doesn't interfere with game-play. When using "load" you can load assets while the game is running (like between levels) and you don't have to use string literals (constants) like you do with preload. In other words, you can build the strings dynamically and store them in a variable, then give 'load' the variable containing your string.
Hope that helps a bit. _