# UInstancedStaticMeshComponent::AddInstances does not appear to be adding per-instance previous transforms when enabled 

**URL:** <https://forums.unrealengine.com/t/uinstancedstaticmeshcomponent-addinstances-does-not-appear-to-be-adding-per-instance-previous-transforms-when-enabled/2689125>\
**Category:** Rendering\
**Tags:** unreal-engine, Epic-Pro-Support, question\
**Created:** [December 3, 2025, 12:50am UTC](https://forums.unrealengine.com/t/uinstancedstaticmeshcomponent-addinstances-does-not-appear-to-be-adding-per-instance-previous-transforms-when-enabled/2689125 "2025-12-03T00:50:48Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous-edc](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous-edc](https://forums.unrealengine.com/u/anonymous-edc)\
**Post date:** [December 3, 2025, 12:50am UTC](https://forums.unrealengine.com/t/uinstancedstaticmeshcomponent-addinstances-does-not-appear-to-be-adding-per-instance-previous-transforms-when-enabled/2689125/1 "2025-12-03T00:50:48Z")

</div>

Hi, I’d like to report a bug in the instanced static mesh component in regards to motion vectors:

When per-instance previous transforms are enabled (SetHasPerInstancePrevTransforms(true)), the ISM expects as many transforms in PerInstancePrevTransform as there are instances as can be seen in UInstancedStaticMeshComponent::MakeInstanceDataFlags:

```auto
Flags.bHasPerInstanceDynamicData = PerInstancePrevTransform.Num() > 0 && PerInstancePrevTransform.Num() == GetInstanceCount();

```

When you add a single instance via AddInstance, the ISM will also add an element to PerInstancePrevTransform.

```auto
int32 UInstancedStaticMeshComponent::AddInstanceInternal(int32 InstanceIndex, FInstancedStaticMeshInstanceData* InNewInstanceData, const FTransform& InstanceTransform, bool bWorldSpace)
{
...
	if (bHasPreviousTransforms)
	{
		PerInstancePrevTransform.Add(NewInstanceData->Transform);
	}

```

However, when you add multiple instances via AddInstances, the ISM will not adjust PerInstancePrevTransform accordingly.

As a workaround, you can enable SetHasPerInstancePrevTransforms after the AddInstances call, but this is not a good solution when you need to add instances more than once. You can disable SetHasPerInstancePrevTransforms before the call and re-enable it after the call, but this will get expensive if there are a lot of existing instances. It will also likely break motion vectors for one frame.

This is how we fixed it in our project:

```auto
TArray<int32> UInstancedStaticMeshComponent::AddInstancesInternal(TConstArrayView<FTransform> InstanceTransforms, bool bShouldReturnIndices, bool bWorldSpace, bool bUpdateNavigation)
{
....

	// CUSTOM CODE BEGIN
	if (bHasPreviousTransforms && PerInstancePrevTransform.Num() < NumInstances) // the second condition is probably unnecessary
	{
		PerInstancePrevTransform.Reserve(NumInstances);

		for (InstanceIndex = NumInstances - Count; InstanceIndex < NumInstances; ++InstanceIndex)
		{
			PerInstancePrevTransform.Add(PerInstanceSMData[InstanceIndex].Transform);
		}
	}
	// CUSTOM CODE END

	InvalidateCachedBounds();
	return NewInstanceIndices;
}

```

---

<div class="post-metadata">

**Author:** ![anonymous-edc](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous-edc](https://forums.unrealengine.com/u/anonymous-edc)\
**Post date:** [December 3, 2025, 12:50am UTC](https://forums.unrealengine.com/t/uinstancedstaticmeshcomponent-addinstances-does-not-appear-to-be-adding-per-instance-previous-transforms-when-enabled/2689125/2 "2025-12-03T00:50:52Z")

</div>

**Steps to Reproduce**  
I don’t remember if it crashed, asserted or simply didn’t work but these are the repro steps (from memory):

UInstancedStaticMeshComponent \*ISM = NewObject\<UInstancedStaticMeshComponent\>(this);

ISM-\>SetStaticMesh(MyStaticMesh);

ISM-\>SetHasPerInstancePrevTransforms(true);

ISM-\>SetMobility(EComponentMobility::Movable);

ISM-\>RegisterComponentWithWorld(GetWorld());

TArray\<FTransform\> Transforms;

Transforms.SetNum(10);

ISM-\>AddInstances(Transforms, false);

---

<div class="post-metadata">

**Author:** ![Louimatic](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/louimatic/32/1223385_2.png) [@Louimatic](https://forums.unrealengine.com/u/Louimatic)\
**Post date:** [December 3, 2025, 11:05pm UTC](https://forums.unrealengine.com/t/uinstancedstaticmeshcomponent-addinstances-does-not-appear-to-be-adding-per-instance-previous-transforms-when-enabled/2689125/3 "2025-12-03T23:05:47Z")

</div>

Hi there,

Thank you for reporting this. Using your information I managed to reproduce this on my end quite easily. It did not crash but I was able to see it didn’t add the previous transforms instances to the PerInstancePrevTransform array. Additionally it’s worth noting that updating the transform of any instances will not update the array or effect the transform of the instance due to having an invalid index.

I don’t see this bug currently tracked, so have submitted a bug report. When it is reflected publicly you will be able to [view it here](https://jira.it.epicgames.com/browse/UE-356699).

Cheers,

Louis

---

<div class="post-metadata">

**Author:** ![anonymous-edc](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous-edc](https://forums.unrealengine.com/u/anonymous-edc)\
**Post date:** [December 3, 2025, 11:09pm UTC](https://forums.unrealengine.com/t/uinstancedstaticmeshcomponent-addinstances-does-not-appear-to-be-adding-per-instance-previous-transforms-when-enabled/2689125/4 "2025-12-03T23:09:55Z")

</div>

Excellent! Thank you Louis!

---

<div class="post-metadata">

**Author:** ![AGENT184](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@AGENT184](https://forums.unrealengine.com/u/AGENT184)\
**Post date:** [September 14, 2026, 2:21pm UTC](https://forums.unrealengine.com/t/uinstancedstaticmeshcomponent-addinstances-does-not-appear-to-be-adding-per-instance-previous-transforms-when-enabled/2689125/5 "2026-09-14T14:21:25Z")

</div>

[Fixed: per-instance motion vectors on UInstancedStaticMeshComponent (TAA/TSR ghosting) - Development / Rendering - Epic Developer Community Forums](https://forums.unrealengine.com/t/fixed-per-instance-motion-vectors-on-uinstancedstaticmeshcomponent-taa-tsr-ghosting/2766884)  
try this
