Interface not working despite being implemented?

I’ve got a system I’m testing that acts as a fancy container for attack montages and uses a key system to get the right attacks. There is an actor component and an object that work together to do this. The object acts as a validator for the keys. The object uses an interface that the component calls. So component is given a key, the key is validated using an object that has the Validator interface, then the component returns an attack montage if a match is found. I have an object made with the interface implemented but when run the object acts as though it does not have the interface implemented.


Here a character BP calls the component to pass in a key and get an attack montage. The component has an object that implements the interface needed set in the defaults for the validator object.


Here is the validator object with the interface implemented.


And here is where the object gets called using the interface function, however I saw it wasn’t working and attached the print string check which shows the object does not implement the interface.

Am I missing something? What UE trickery is this and why does my object not have the interface despite being the only object in the project that does have it implemented?

its worth checking if the object is valid, maybe it got garbage collected or something?

Thank you. I had actually just found the solution from someone in a discord I’m in. The object was never actually constructed. I assumed by setting its default value in the component it would automatically be constructed for me but nope, still had to do it in the BP of the component. I was really thrown off since the object appeared to be instantiated as it returned true to a validity check and printed the right display name but this has something to do with BP archetypes and them still being UObjects. Deeper UE knowledge than I have right now but I’ll add an official solution reply.

1 Like

Object variables do not get automatically instantiated, even if they have a default value, the way Actor Components do when they are on an actor. The object variable still needs to be constructed so by adding this to the component class holding the object variable I was able to fix my issue.


It’s over my head but I guess the default value that is assigned to an object ref is not actually the object but the archetype, which is a different object and why the variable returns valid when checked despite not being constructed. This object will also not have the interface resulting in the interface function call returning only the default values of the output.

for what you seem to be doing try using a DataAsset?

I’ve actually never used a data asset but after looking into them I don’t think that fits here. I am storing the object as a variable because changing the object will change the functionality of the component (the owner of the object). So related to this problem, nothing is just data which is why I use the interface on the validator objects, so I can swap them out and change how the component chooses the montages to return.

UCLASS(EditInlineNew, DefaultToInstanced)

this might be what you want then