I faced some problem in unreal while changing from blueprint to c++ code in project setting in unreal engine 4.27.2

My friend has the same compile error on Mac, XCode 13.3 and UE 4.27.2… I checked the source code and it appears that a variable is initialized but not used. This raises the error. What we did was to comment out the lines 1279 and 1293 in Engine/Source/Runtime/Engine/Classes/Materials/Material.h file as the assigned variable is never used in the code.

const TArray<UMaterialFunctionInterface*>* Layers = &LayersExpression->GetLayers();
const TArray<UMaterialFunctionInterface*>* Blends = &LayersExpression->GetBlends();
#if WITH_EDITOR
// ********** COMMENT OUT THIS LINE **********
//const TArray<FText>* LayerNames = &LayersExpression->GetLayerNames();
#endif
	
// Handle function overrides when searching for parameters
if (MaterialLayersParameters)
{
	const FName& ParameterName = LayersExpression->ParameterName;
	for (const FStaticMaterialLayersParameter& LayersParameter : *MaterialLayersParameters)
	{
		if (LayersParameter.ParameterInfo.Name == ParameterName)
		{
			Layers = &LayersParameter.Value.Layers;
			Blends = &LayersParameter.Value.Blends;
#if WITH_EDITOR
			// ********** COMMENT OUT THIS LINE **********
			// LayerNames = &LayersParameter.Value.LayerNames;
#endif
			break;
		}
4 Likes