Hi everyone,
I have a really strange issue with my hierarchical static instanced meshes in 4.27 when I package my game up for distribution.
My game uses a HISM component to render soldiers in a company. A company is basically an invisible character which navigates around and the soldiers use that as a reference to understand where they should be stood at any given moment. A soldier is just a UObject containing an FTransform and a bunch of data related to which animation it should be playing (I’m using vertex animations baked into a texture).
I separately run logic in the company’s Tick function to update the positions of soldiers, and then my HISM component runs through the lists of soldiers and updates their rendering info on that tick, like so:
for (int32 i = 0; i < NumSoldiers; i++) {
InstanceTransforms.Add(pair.Value.Soldiers[i]->GetSoldierTransform());
pair.Value.HISM->UpdateInstanceTransform(i, pair.Value.Soldiers[i]->GetSoldierTransform(), true);
pair.Value.HISM->SetCustomData(i, pair.Value.Soldiers[i]->CustomData);
}
So every tick, my HISM is looping through every soldier and calling UpdateInstanceTransform, and SetCustomData.
The issue I have is that this works great in the editor using PIE running under a single process like so:
But if I play in a packages build, or launch a standalone session under a separate process, the HISM is now broken completely. It only updates once every 5-10 seconds, like the world’s slowest slideshow. Note that I know the game is correctly updating the soldiers because I can collide with them, it is ONLY the rendering which isn’t working:
Notice how you can see the little sphere representing the invisible company character moving smoothly, and then the soldiers are just frozen and then suddenly teleport.
To make things even weirder, losing focus on the window by bringing up the start menu fixes the issue. It only happens if the game window has focus.
Anyone have any idea what on Earth is going on here? Is it a bug? Have I messed something up?
Thanks!