- Home /
Monobehavior inheritance Levels
Are there any potential issues with having more than 5 levels of inheritance from Monobehaviour?
for example: Panzer4_Controller<Tank_Controller<Vehicle_Controller<Unit_Controller<Base_Unit<Monobehaviour
I should also mention that everything up to Panzer4_Controller
are abstract classes. and two are wrappers to for event/delegates.
public abstract class VehicleController<V> : UnitController<VehicleController<V>> where V: VehicleController<V>
{
}
public abstract class UnitController<T>: Unit where T: Unit
{
public delegate void UnitEventHandler(T vehicleController);
public event UnitEventHandler OnUnitEnabled;
public event UnitEventHandler OnUnitDisabled;
}
This is 7 Levels + Monobheaviour already inherits from about 4 more (Monobehaviour:Behaviour:Component:Object:Object)
which makes it over 9 levels.
I get a warning if I have more than(usually by accident) 7 levels with non monobehaviour classes that's why I am wondering if this would also cause any issues down the line.
Edit: it cut out half of my question... just fixing it
Thanks!
I don't see why aslong as your code is structured and readable for yourself and ($$anonymous$$m if you are working with others) :)
Thank you, I edited my question a bit more... Just trying to have a structure that is expandable later. All but last class are abstract.I know I sounded insane when I said I wanted 10 levels haha.
Your answer
Follow this Question
Related Questions
MonoBehaviour Inheritance, Singletons and Generics 1 Answer
Issues Inheriting classes and monoBehaviour 1 Answer
How to make different types of Objects in database? 1 Answer
C# Question - Do I Have to inherit from MonoBehaviour? What happens if I don't? 2 Answers
Is it possible to make sealed overridden MonoBehaviour method. 0 Answers