I implemented a state system. Parent (abstract) base class is in C++ (child of UObject), actual classes are blueprints. Blueprints aren’t objects though, so I have to instantiate each class once and save them into a Map<ControlInputStateBase “Class Reference”, ControlInputStateBase>. I do this in the ThirdPersonController’s Constructor.
I have five states now and my Constructor is turning into spaghetti, so I want to simplify things by converting this into C++. My problem is that I am unsure how to declare the TMap because I do not know what the C++ equivalent is to a “Class Reference” type.
My first idea was to use TSubclassOf like this:
TMap<TSubclassOf, UControlInputStateBase> stateRepository;
But it gives me five errors, e.g. ‘UControlInputStateBase’: undeclared identifier" and “UControlInputStateBase is not a valid identifier.” I also tried using an enum, but I got another error “TDefaultMapHashableKeyFuncs: unspecialized class template can’t be used as a template argument for template parameter ‘KeyFuncs’” so enums are out, too, I suppose.
Does anyone know how I can fix my current problem? Thank you in advance!