Download

Dynamically Changing TranslucencySortPriority

Our game has several dynamically loaded 2d environments.

We are trying to change the TranslucencySortPriority of some sprites during runtime.

It seems that the new values do not take affect.

If I pause the game, hit f8, and adjust the priority, even back to the same value, it works correctly.

Is there an additional step to do - do we need to invalidate or recompile the material, or somehow indicate that the TranslucencySortPriority has changed for the rendering engine?

Thanks for any help/feedback

I dont know if this will work, but after setting the new priority try calling “MarkRenderStateDirty();” this will cause the component to recreate its render state. It may be better to pass the value over to the render thread rather than recreating the state every time. Which could be done via overriding SendRenderDynamicData_Concurrent(); but it looks like the TranslucencySortPriority variable is private on the scene proxy, so you would probably need to add your own setter to the scene proxy.

Thanks GalaxMan2015…

I ended doing both
Sprite->UpdateBounds();
Sprite->MarkRenderStateDirty();

And got it working - not sure if the UpdateBounds was needed…

Thanks for replying