Scenewide Variables

I don’t know if this is already a thing, I tried googling it and couldn’t find it. If it is I would love to know what it is called and get a link to the documentation.

Basically it is variables that is specific to the scenes. You can access it like a static variable (using a class or whatever for that), but it can contain scene specific references. I often find myself with a class that needs to have a reference too it in most other scripts I make, but with this that could be SceneVariables.ThatClassINeed instead of an independent variable on each script that if it needs to be changed will be a hassle.

I know this is similar to simpletons, but think this would be a nicer way to allow people to achieve stuff like that.

Thank you for reading.

There’s nothing built in for this but it’s easily achievable with the tools at hand. You could simply make a static Dictionary<Scene, MyVariableholder> - thus having scenewide variables easily accessible. You’d have to of course do a little bookkeeping, but it’s nothing crazy.