Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

CodeSmile

3
Posts
8
Following
A member registered Sep 20, 2022

Recent community posts

You can solve this problem quite easily with a "launch" scene. 

Put all your DontDestroyOnLoad objects (and singletons) in that launch scene. To enter playmode in a specific scene, you would have a component (or editor script) that additively loads the launch scene content when entering playmode. Any timing issues need to be relaxed by invoking events (Action, Func) that interested components register with.

If a DontDestroyOnLoad object needs to reset its state, eg when changing scenes, you hook into SceneManager.sceneLoaded or similar events and perform your task. And then signal a "ready" event.

In your case you've also had dependent code in GlobalController's Awake. This has to be refactored. It's never a good idea to call other components from Awake, that needs to be deferred to Start or OnEnable. In Awake you should only ever get, find or create references but not accessing/calling them to avoid these initialization order issues.

Since you have a class called "GlobalController" you could as well rename it to "EverythingEverywhereAllAtOnce" and it'll still carry the same meaning. If you value tradition, suffix it with "Controller" or "Manager" or similarly broad, thus meaningless, nouns. ;)

Meaning: this class has no clearly defined purpose and thus it came to do all the things in Awake that it shouldn't have.

(1 edit)

Does that mean CC0 (public domain)?
I have to include a license file for every 3rd party content in my submission, and the license needs to be one that's widely accepted for the content type. 
If there's no license file included in the bundle, and you say that the content is CC0, would you allow me to add a license file with the framed text from the CC0 link above?

(1 edit)

Love the sound! But what's the license?
The license is very important pre-sales info for anyone except "don't care" hobbyists. ;)