How to toggle the sprite layer in the game by script?
Good morning I would like to know if you have how to change the layer of the sprite by code for example has two paths to follow one down the ladder and one to pass straight through it has how to change the layer or is there another way to do this? help me please
Comment
Answer by tanoshimi · Dec 08, 2016 at 05:03 PM
GetComponent<Renderer>().sortingOrder = 1;
// etc.
https://docs.unity3d.com/ScriptReference/Renderer-sortingOrder.html
Your answer

Follow this Question
Related Questions
How to Change the Sorting Layer of Tk2dsprite ? 0 Answers
2D sprite: layer issue 1 Answer
I draw a sprite and i cant put sprites in unity. 0 Answers
Why am I getting this error "Object reference not set to an instance of an object" 1 Answer
How can I apply a 9-slice scaling to a mash object using a shader? 0 Answers