Need help with project architecture (specifically store/access static values)
I have a simple game prototype, where same base objects can have different "materials" (basically set of Physics Material and Rigidbody properties).
What I want to achieve:
- Set material type via dropdown in inspector
- Get that material properties from somewhere else (note that different materials can modify different parameters) and apply to object
- Be able to quickly change settings of each material without changes in scene
Here's what I plan to do:
- Create prefab for base object
- Store somewhere else each material parameters (mass, bounciness etc.)
- Attach a script to prefab, which contains:
a) enum for material types and hold public variable of that type (here's how I achieve dropdown in inspector)
b) "setup function" called at Start() which gets parameters of selected material from somewhere else and applies it to this instance of prefab
Then problems begin...
Being complete newbie at programming I can't make up with a good idea about that "somewhere else". I don't want to use external files for prototyping, and have no idea how to store game data in code.
The best I came up with is to create a class filled with classes for each material, where I store values (they never change except manually tweaked in inspector, so is static class a good choice?).
Anyway this requires IF loop for each material type in setup function of base object's script, so the whole Idea feels dumb.
Any good advice?