I have an Actor that has several actor components: componentA, componentB, componentC and component D.
What I want to do, is to be able to select, in the editor, one of the components A to C from component D.
What I managed to do so far is:
add a string array to componentD
add the names of the components (eg. componentA and componentB) in the array
in BeginPlay of the componentD, I add the references to componentA and componentB by name. (add all components of type to a TMap<name, component>, and retrieve them from there)
I am sure this is not the ideal solution, so I tried, with no luck, to find another method of selecting components in the editor.
I am working with C++, so any help would be appreciated.
The Editor doesn’t (unfortuantely) provide any means for you to change the component class of a C++ inherited component right now. It’s something that’s been requested for a long time IIRC.
You can declare a component pointer UPROPERTY() and mark it with “EditDefaultsOnly” instead of “VisibleDefaultsOnly / VisibleAnywhere” etc. - and while that does give you a dropdown it does create some other problems like not showing all properties in the details panel etc.
Thank you for your fast answer.
I am sorry I did not explain my problem better, but I do not want to change the component class of a C++ inherited component.
My setup is something like this:
On the same actor I have:
three CameraComponents
one CameraSelectorComponent
In the CameraSelectorComponent I would like to display a list of all CameraComponents that are added to that same owner actor, and select one or more.