Rendering prefabs

Hello,
I’m instantiating a prefab and adding random sprite frames to it and I throw the prefab upwards and it falls down. I want to render prefab based on sprite frame. Lets say there are 3 prefab sprites star1, star2 and star3. when prefab sprite is star1 it should always be above star2 and star3 if they meet while they are thrown upward.
I tried changing Z axis but that doesn’t work. Currently rendering is based on time they are instantiated, If star1 is instantiated first and then star2 is instantiated then star2 will render over star1.
I’m using cocos creator v 3.4.1.

You can use setSiblingIndex to adjust the rendering order, Rendering Order · Cocos Creator

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.