Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Accessing "Order in Layer"

Discussion in '2D' started by Phob1a, Dec 16, 2013.

  1. Phob1a

    Phob1a

    Joined:
    Dec 16, 2013
    Posts:
    5
    I am making a 2D game and I really need to know how to access and modify dynamically the "Order in Layer" parameter of the Sprite Renderer of a Game Object. I've searched a lot and I couldn't find anything. :(
     
  2. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,338
    Renderer.sortingOrder

    --Eric
     
  3. Phob1a

    Phob1a

    Joined:
    Dec 16, 2013
    Posts:
    5
    I love you! Thanks a lot!
     
  4. asubramanian

    asubramanian

    Joined:
    Feb 7, 2014
    Posts:
    1
    Awesome, Thanks
     
  5. yosash21

    yosash21

    Joined:
    Jan 8, 2015
    Posts:
    1
    Thanks!! Works well
     
  6. richardzzzarnold

    richardzzzarnold

    Joined:
    Aug 2, 2012
    Posts:
    136
    Is this an attribute able to be animated?
     
  7. webox

    webox

    Joined:
    Aug 27, 2015
    Posts:
    72
    I'm pretty sure the answer is no, but you can change it programmatically in the same place where you switch animations..

    Edit: Tested it, you can't do it..
     
  8. magnsigmus

    magnsigmus

    Joined:
    Sep 16, 2019
    Posts:
    1
    You're the best Eric!
     
unityunity