Force a Sprite always-on-top

Hi there.

Is there a way to force a Sprite always-on-top and prevent below? Thanks !


Want to show how you are adding the sprite to the scene? a simple playground will help us show ways of doing it that fit your use case

I create it with these lines.

const spriteManager = new BABYLON.SpriteManager("spriteManager", "icon.png", 1, 256);
const sprite = new BABYLON.Sprite("pickIcon", spriteManager);
sprite.height = 0.5;

Forgive me for not adding a PG

set the rendering group id of the sprite manager to 1 and it will always be on the top.

spriteManager.renderingGroupId = 1;

Excellent ! working like a charm. thank you!

1 Like