playMaker

Author Topic: Sprite / SetOrderInLayer  (Read 1859 times)

Thore

  • Sr. Member
  • ****
  • Posts: 480
Sprite / SetOrderInLayer
« on: September 06, 2018, 07:38:13 PM »
SetOrderInLayer.cs
Gets the SpriteRenderer of suitable GameObject, and sets the "Order in Layer" property to an integer you provide.

Purpose
In 2D games with a camera set to orthographic projection, the Z axis is ignored. The layers are used to roughly sort what is background, foreground etc. But within those layers, you use order in layer to determine what is in front of something else. With this action, you can change that order.

Example
In my case, a character carries a weapon on their back. When the weapon is drawn, it needs to change order in layer so it's drawn in front of the character.
« Last Edit: September 06, 2018, 07:42:05 PM by Thore »

Fat Pug Studio

  • Beta Group
  • Hero Member
  • *
  • Posts: 1294
    • Fat Pug Studio
Re: Sprite / SetOrderInLayer
« Reply #1 on: September 07, 2018, 02:47:02 AM »
Excellent, thanks!
Available for Playmaker work

PlaymakerNOOB

  • Full Member
  • ***
  • Posts: 219
Re: Sprite / SetOrderInLayer
« Reply #2 on: September 07, 2018, 07:22:23 AM »
Awesome thanks!