Download

Using Unreal interfaces as Member variable.

I’m having an issue with some classes that use plain C++ interfaces as member variables crashing the editor, if I stop playing in the editor and hit play a second time. I’ve tried deleting them manually with my classes destructor, and I’m still experiencing the same crashes. I just wanted to double check that the Unreal based implementation of interfaces can be used as member variables of raw pointers.

Something like:



class PROJECTNAME_API UFoo
{
 GENERATED_BODY()

public:
 UFOO()

private:
    IGameTime *gameTime;
};


I also want to double check that I can use new with Unreal’s implementation to create instances of the classes inheriting the interface. Currently, the classes that need the interfaces are purely in blueprints, so I’ve just been using new as a workaround for hooking up dummy classes allowing us to test functionality.