Is there a callback that is called when a new component is added to an actor?
I have a class which is an actor and I would like to enforce that only the components that implement a particular interface can be added to this actor. And I would like to do this component validation in C++ code.
Is there a way to achieve this both at Editor time and at Runtime?
asked Apr 19 '17 at 08:13 AM in C++ Programming
I don't know of any callback, but there is the function AActor::AddComponent ( https://docs.unrealengine.com/latest/INT/API/Runtime/Engine/GameFramework/AActor/AddComponent/index.html ). I would strongly guess that this is called internally whenever a component should be added to an actor. So for your actor in question you can override this function and if the component implements a certain interface, call the parent method, and if not, simply return NULL (and see what happens, because I havn't tried it and don't know what will happen!).
Follow this question
Once you sign in you will be able to subscribe for any updates here