RealDocs

UActorComponent::MarkRenderInstancesDirty

function Engine Since 4.20
#include "Components/ActorComponent.h"
Access: public

Description

Marks per-instance render data (transforms, custom float data) as dirty so it is flushed to the renderer at end of frame. Primarily used by instanced mesh components.

Caveats & Gotchas

  • This is specifically for instanced rendering — it schedules an update to per-instance GPU buffers via SendRenderInstanceData_Concurrent() on the proxy. Calling it on a component that has no instance data has no effect.
  • Modify all instances before calling this once; calling it after each individual instance edit is wasteful as only one flush happens per frame regardless of how many times the flag is set.

Signature

ENGINE_API void MarkRenderInstancesDirty()

Return Type

void

Example

Updating instances and marking dirty C++
void UMyInstancedComponent::UpdateAllInstances()
{
	for (int32 i = 0; i < GetInstanceCount(); ++i)
	{
		FTransform NewTransform = ComputeInstanceTransform(i);
		UpdateInstanceTransform(i, NewTransform, false, false); // defer mark
	}
	MarkRenderInstancesDirty(); // single flush after all updates
}

Version History

Introduced in: 4.20

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.