Set material node does nothing on MaterialBillboardComponent

I want to use a Dynamic Material Instance, or at least change the material of a Sprite inside a MaterialBillboardComponent. The SetMaterial node from PrimitiveComponent doesn’t do anything, and neither does this:

(this does not work to change any of the other parameters either, like Base Size)

Is there any way to change the material used in a MaterialSpriteElement from BP/C++ ?

This does what I want:

void UMaterialBillboardComponent::SetMaterial(int32 ElementIndex,class UMaterialInterface* Material)
{
	if (Elements.IsValidIndex(ElementIndex))
		Elements[ElementIndex].Material = Material;

	MarkRenderStateDirty();
}

Do you also know how to do it in blueprint? This caused me today a huge headache… failed in changing the material of a materialbillboard in every way possible, and I can’t use c++ :confused:

yep I would really like to do it in c++, but changing my whole setup only for this bug. If I don’t find a workaround I will consider, thanks :slight_smile:

I use the blueprint only version, no visual studio, null experience… but seems like the last post of this thread have found a workaround: I can't get Dynamic Material Color changes to work... - Blueprint - Epic Developer Community Forums

If you make that change in C++, SetMaterial node in Blueprint works.

How is it changing anything about your setup ? It’s an engine source code change, nothing to do with game code.