Using functions as a struct variable

Hi,

I am creating a struct for menu items. The struct contains information about each of the items. I would also like to have a function as a variable that can be called.

Struct code:

struct FInteractiveMenuItem
    {
    	FString Title;
    	bool bEnabled;
    	FString ToolTip;
    	// a function to be called when the item is clicked... 
    };

So for example I could have a menu item that has the title “Use”, “Use the computer” when hovered over and then call the function when it is clicked. This function would be different for each menu item.

I believe this would be doable with a delegate, but I have no clue how to take the approach.

Thank you in advance

Hello! You can either use delegate (Delegates | Unreal Engine Documentation) or TFunctionRef (https://www.orfeasel.com/understanding-lambda-expressions/)