The amount of components in my inspector window tends to rack up quickly for my character classes with the player having a component for each behavior.
I want to see if I can reduce the clutter by using monobehaviors only for handling the visual elements or anything related to transforms in the world. Basically, looking at monobehaviours as a way to represent a game object thats rendering.
For example, I want to create a pistol in my scene for the player to shoot.
- The player weapon handling class will hold this data rather than the object in the world.
- The pistol class (not instantiated in the scene) holds the logic of what should happen if the player shoots.
- It holds base data such as reload speed, fire rate, damage, etc.
- Things that are relative to whats happening in it’s own instance is handled by a monobehavior class in the scene. It contains coroutines for reloading and shooting but the coroutines arent stored inside of it and neither is localized data such as time before next shot and current ammo.
- This is because there may be other players or classes that use this pistol class too.
- As for the physical representation, it would either contain an object id or prefab inside the class.