So i have 2 controllers that have their own behaviour but also share like 7 functions and variables. Inheritance seems like a logical thing to do so my idea was to make a basecontroller that has those shared things. I experienced UE4 putting limits on inheritance and composition because i can’t inherit from some class when i’m already inheriting from another class (1 controller inherits from AAIController and the other from APlayerController).
Now my question is how should i link these controllers in a correct way with the base controller in UE4?
Any help is appreciated.
I also found some information about structs but they are more for data storing than complex functions that interact with the world.
You are correct, there is a limit in inheritance, specially with actor classes. A controller cannot inherit from both AIController and PlayerController, but what you can do is make an interface to treat them as if they where a single class. Take a look at interfaces here: A new, community-hosted Unreal Engine Wiki - Announcements - Unreal Engine Forums
So first i made an interface that just implements all the functions, but since it can’t have member variables they all have to receive way too many parameters. Since i don’t understand what you said about treating them as if they were a single class, i’d like you to explain that a bit more so i can try that !
A way of not storing the members in both playercontroller and aicontroller would maybe be making a class that stores the member variables. Next the interface that inherits from the class, defining the functions, and next the aicontroller and playercontroller inheriting from the interface but idk if that is a good way.