SMeshWidget warning

LogUMG: Warning: SMeshWidget did not render a run because of one of these Brush: nullptr, NumVertexes: 4, NumIndexes: 6

Anyone know what it mean?

when I hit save, all widgets vanish and this warning spamming the log console… I use the code from this post.
SMeshWidget

here is the code throwing the warning;

int32 SMeshWidget::OnPaint(const FPaintArgs& Args, const FGeometry& AllottedGeometry, const FSlateRect& MyCullingRect, FSlateWindowElementList& OutDrawElements, int32 LayerId, const FWidgetStyle& InWidgetStyle, bool bParentEnabled) const

	else
	{
		// We have no render runs. Render all the meshes in order they were added
		for (int i = 0; i < RenderData.Num(); ++i)
		{
			const FRenderData& RunRenderData = RenderData[i];
			if (RunRenderData.RenderingResourceHandle.IsValid() && RunRenderData.VertexData.Num() > 0 && RunRenderData.IndexData.Num() > 0)
			{
				if (RunRenderData.PerInstanceBuffer.IsValid())
				{
					// Drawing instanced widgets
					const int32 NumInstances = RunRenderData.PerInstanceBuffer->GetNumInstances();
					if (NumInstances > 0)
					{
						FSlateDrawElement::MakeCustomVerts(OutDrawElements, LayerId, RunRenderData.RenderingResourceHandle, RunRenderData.VertexData, RunRenderData.IndexData, RunRenderData.PerInstanceBuffer.Get(), 0, NumInstances);
					}
				}
				else
				{
					// Drawing a single widget, no instancing
					FSlateDrawElement::MakeCustomVerts(OutDrawElements, LayerId, RunRenderData.RenderingResourceHandle, RunRenderData.VertexData, RunRenderData.IndexData, nullptr, 0, 0);
				}
			}
			else
			{
				if( !GUsingNullRHI )
				{
					UE_LOG(LogUMG, Warning, TEXT("SMeshWidget did not render a run because of one of these Brush: %s, NumVertexes: %d, NumIndexes: %d"),
						RunRenderData.RenderingResourceHandle.IsValid() ? TEXT("valid") : TEXT("nullptr"),
						RunRenderData.VertexData.Num(),
						RunRenderData.IndexData.Num());
				}
			}
		}
	}

	return LayerId;
}

It means what it said, brush is null pointer (no set) so Slate don’t know how to render it, if you look on code other condition to throw this warning is lack of vertices and index data which is not the case

Slate set graphical appearance and positioning based on information in FSlateBrush so check if you set everything properly

This SMeshWidget code example don’t use FSlateBrush, it use SlateVectorArtData to get graphical appearance such as materials and mesh… The code itself is working but if you compile and hit save the widget disappear and this warning telling me that there is a brush with nullptr. This code is from 4.14 so there is something changed in the way of using SMeshWidget in 4.19.2 but I still cant find the problem… I can try to set FSlateBrush but I don’t know how… can you help me on that?

This is where appearance variables are stored;

    struct FRenderData
    	{
    		/** Holds a copy of the Static Mesh's data converted to a format that Slate understands. */
    		TArray<FSlateVertex> VertexData;
    		/** Connectivity data: Order in which the vertexes occur to make up a series of triangles. */
    		TArray<SlateIndex> IndexData;
    		/** Holds on to the material that is found on the StaticMesh. */
    		TSharedPtr<FSlateBrush> Brush;
    		/** A rendering handle used to quickly access the rendering data for the slate element*/
    		FSlateResourceHandle RenderingResourceHandle;
    		/** Per instance data that can be passed to */
    		TSharedPtr<ISlateUpdatableInstanceBuffer> PerInstanceBuffer;
    	};
    	TArray<FRenderData, TInlineAllocator<3>> RenderData;

Brush is automatically set by AddMesh()

    static const FVector2D DontCare(FVector2D(64, 64));
    uint32 SMeshWidget::AddMesh(USlateVectorArtData& InMeshData)
    {	
    	InMeshData.EnsureValidData();
    
    	FRenderData& NewRenderData = RenderData[RenderData.Add(FRenderData())];
    	UMaterialInterface* MaterialFromMesh = InMeshData.GetMaterial();
    	if (MaterialFromMesh != nullptr)
    	{
    		NewRenderData.Brush = MakeShareable(new FSlateMaterialBrush(*MaterialFromMesh, DontCare));
    		NewRenderData.RenderingResourceHandle = FSlateApplication::Get().GetRenderer()->GetResourceHandle( *NewRenderData.Brush );
    	}
    	SlateMeshToSlateRenderData(InMeshData, NewRenderData.VertexData, NewRenderData.IndexData);
    	return RenderData.Num()-1;
    }

It get brush info from SlateVectorArtData assigned mesh material.
I think this is a engine bug… I’m not a pro c++ programmer I’m just a beginner but I understand the codes… The example project is provided by epic game staff so the code should be ok.

Then something is lacking in mesh data “MaterialFromMesh”

Thanks to for helping me to fix the problem! If it can help someone, the problem was Hot Reload causing issue. Just build the project with editor closed will fix the problem.