Interface Variables

What I want to do:

I want a blueprint with a public variable that can be filled with any object that implements a certain interface.

What I did:

I created a public variable with the variable type “My Interface”, when I try to assign objects, which implement said interface, to this variable by dragging them in the Editor it does nothing

I am not sure if that is supposed to work, I am especially confused by what you mean by ‘dragging’ in this context. Do you want an Actor/Object variable that can only be assigned a value if that Actor/Object implements a certain Interface? What I would try to do is using an Actor or Object type variable and checking in the ConstructionScript if it implements ‘MyInterface’. If not, I set the variable to null.

Something like this:

Thanks, that helps a lot.

By dragging I meant assigning a variable in the Scene in Editor via drag and drop.

Would you by any chance know the point of setting the type of a variable to an interface?

I think when you have an Actor reference variable marked as ‘InstanceEditable’, you can only assign already instantiated objects to it (objects that are already spawned in the scene). That means that you can’t drag&drop classes from the ContentBrowser, only from the actual scene, but then I don’t think drag&drop operation is allowed, I am only aware of a drop down list allowing me to select an already spawned actor.

I have never used a ‘MyInterface’ type variable, as calling interface functions only require reference to the object that implements the interface, not to the actual interface itself. What exactly are you trying to achieve?

that was exactly what I did.

I want to have Buttons interacting with my game logic, and i want to do it with interfaces, so that i can have various types of Buttons without them having to be related to each other…