I’m trying to set a delegate function for the OnClicked() attribute of an SButton. And have that function modify a member variable. I’ve begun with the editor mode plugin wizard to set up my c++ files.
In my .h I have
class FVASFVPluginEdModeToolkit : public FModeToolkit
float completePercent = 0.0f;
In the constructor of the plugin, I can set up functions in the Locals struct which can be set as the OnClicked_Static() attribute of an SButton. But as soon as I try to modify a member variable of the plugin in that function I get the compilation error “a nonstatic member reference must be relative to a specific object”.
Your function is not static you would need to ■■■ “static” before FReply in function decleration and it seems it suppose to not be static considering you modifying inner varable.
For non-static functions you need to point to object instance on which function will be called in, sale since this is local struct you should add a class namespace to function pointer (but im not sure)
I’m not sure if TAttributes bindings can work with structs.
Speaking of which you setup seems to be very wierd, you making struct inside constructor? where object of struct? this struct will die once constructor is done, so you might have ferther problems later on.
By looks of it you seem to want to create anonymous function, if that the case there easier way to do so:
Ah that makes sense. Yeah I don’t want a static function. I really don’t want the function to die once the constructor is done. Should I instead define a class member function outside of the constructor, and put it’s definition in the header file?
How could I then link that class function to the button’s OnClicked attribute?