Does having lots of different z indexes for 2d assets affect performance?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Socrates

If i use z indexes to assign draw order rather than just using node order is there a performance cost, or do they just do the same thing? I noticed my game running slower when using z indexes with a lot of things, but was wondering if that was the reason or if it’s just because of the large amount of assets added.

:bust_in_silhouette: Reply From: Asprithe

I don’t think it does,
all that z index does is control of the order in which nodes render.

Just make sure you don’t insert z index higher than max:

  • MATERIAL_RENDER_PRIORITY_MAX = 127 — The maximum renderpriority of all materials.

and lower than min:

  • MATERIAL_RENDER_PRIORITY_MIN = -128 — The minimum renderpriority of all materials.