Use of BEGIN_SLATE_FUNCTION_BUILD_OPTIMIZATION

Hello everyone,

I want to know what is the use of the BEGIN_SLATE_FUNCTION_BUILD_OPTIMIZATION in a slate widget.

I am using slate after a few months and there is a new option to add slate widgets through the Slate Widget custom template class and I got something like this.

It is not compiling unless I comment out the 2 parts.

//BEGIN_SLATE_FUNCTION_BUILD_OPTIMIZATION
void SInventoryWidget::Construct(const FArguments& InArgs)
{
	/*
	ChildSlot
	[
		// Populate the widget
	];
	*/
}
//END_SLATE_FUNCTION_BUILD_OPTIMIZATION
1 Like

Hi there, the presence of the BEGIN_SLATE_FUNCTION_BUILD_OPTIMIZATION macros simply indicates that we wish for the compiler not to attempt to optimize that block of code. Generally these are only placed on very large slate widget declarations as the heavy nesting can cause the compiler to spend a lot of time attempting to optimize the single expression.

We wouldn’t expect this to introduce compile errors however - could you post the exact error message, and perhaps the actual widget definition for us so we can inspect it a bit closer?

3 Likes

I didn’t get any errors after including the #include “SlateBasics.h” header. I guess…