How to validate a component that is added to a blueprint in the editor?

Hello,

I have been working on attaching Unreal as a view/controller to our already implemented game.

There is the concept of Entity in our game that roughly corresponds to an Unreal Actor. The Entity can be just anything and it can also act as a container for children Entities.

Our Entity holds its physics collider separately (if there is any) and it also may or may not have a skeleton attached. So the Entity in our game can correspond to the following actor components:

  1. A Scene Component with a transform but no physics.
  2. A Primitive Component with physics and transform but no mesh
  3. A Static Mesh Component with physics, transform and mesh
  4. A Skeletal Mesh Component with physics, transform, rigged mesh and skeleton.

As far as I know there is no way of creating an Actor hierarchy within an Actor statically within the Editor. In Unity a prefab might include a hierarchy of GameObjects (GameObject = Actor in Unity sense) but in Unreal prefabs (corresponding to blueprints) might only include a hierarchy of components not actors. Of course actors can be added via pointers at run time but not at Editor time. The problem is the Entity in our game has the potential to directly map between both an actor and the above mentioned 4 components.

So what I need is some kind of a component that can be configured to have the above mentioned 4 components’ properties. And it should become an Actor when it is detached from its original actor’s component hierarchy.

I’ve thought about it and the best solution was to create an interface which is implemented by a set of custom components (one for each of the above 4) which inherit both the base versions of the above mentioned components and the interface itself. So every component within my actors’ component hierarchy becomes a potential candidate of becoming an actor itself (when detached).

But I would like to have a way to validate that whenever the game programmer or an artist creates an Entity blueprint in the Unreal Editor the added components to this entity blueprint do implement my EntityInterface. I can do this check in C++. The editor should not let the addition of components that does not implement the EntityInterface.

I’ve found that there are several methods that can notify the CPP side when a property of a class changes. These are PreEditChange, PostEditChange etc. The best place to do this verification seems like PreEditChange method however I have no information about the value the property is changed to at this stage.

So how can I do such a verification?

Best

Same issue faced! Any help??