I have an effect system where status effects like DoTs have their own scripts but all inherit from the same abstract effect class, which is does not inherit from MonoBehavior. I would like to be able to attach effects to projectiles which have a projectile script which does inherit from MonoBehaviour handling damage distribution, movement etc. They are attached directly to the projectile GameObject as a component. The same way I could set a float in the inspector or attach a reference to another GameObject, but instead put a reference to the specific effect class which would then call a constructor and use the resulting object. However, when I add a variable ‘public Effect effect’, nothing shows up in the inspector, so I am unable to attach the necessary object outside of hard coding it into the projectile script. Is there a way around this or am I using a flawed approach?
The only workaround I can currently think of would be to hard code a unique MonoBehavior carrier script for every effect type there is, which could be attached to a prefab, which could then be attached to the projectile script and relay the actual effect object, however this seems unnecessarily complicated to me.