UInterface cannot override dtor nor implements ufunc

I am not entirely sure what your main goal is, but the way you are approaching the problem is not possible, at least with Unreal. An interface class should only provide , like its name says, an interface of functions that any class can inherit from.

You should treat the interface classes like that: with only functions that classes from different parents can have.

Instead of having to push and pop objects at their construction and destruction, try making a “helper” function so that, when you spawn an Actor, it spawns that actor and adds it to the list, while at the same time binding a function to the OnEndPlay(blueprint assignable) delegate that removes the actor from the list. You can go a step further and only add those actors that implement your interface while also calling those interface functions.

Something to note: UWorld has a delegate called “OnActorSpawned”, which is called everytime a new actor is spawned to the world, but this is an internal/private variable. So the best option might be the one I wrote above.

I hope this has been some help. Let me know if this cleared things up a bit.

this approach will also be a bit more flexible when it comes to having other classes and other interfaces involved.

Hi!

I’ve been trying to make an interface that has one of its function exposed for blueprint. Multiple problems occured:

  • Because I’m using a static list to store all object that has the interface (with a push at construction and pop at destruction, I need to define the dtor. However, since it is generated in the generate body macro I can’t do it nor can I use a before or finish destroy since the modified class is not the actual one that is inhereting from uinterface (I don’t know what kind of black magic happens, but when creating an interface from the editor in creates two class, one Uinterfacename and one Iinterfacename)

  • It seems to be a crawling bug but when I gave on the dtor stuff and moved on, when trying to specify
    UFUNCTION(BlueprintCallable) it yields 5 on build.bat

    Error MSB3075 The command “ERASED\Build.bat SDMFEditor Win64 Development -Project=“ERASED” -WaitMutex -FromMsBuild” exited with code 5. Please verify that you have sufficient rights to run this command.