- Home /
Question about Sorting layers according to Y axis
Hello !
I am new to Unity, and I am trying to make a 2D, top-down.I am wondering how I can sort the layer of objects based on their position of the Y axis NOT USING SCRIPT.
I read that i can do it by change to TransparencySortMode.Orthographic Mode. But i cant find it anywhere in my Camera. And i dont know what "distance along the camera's view" mean when i create 2d Game.
I also read that i can Transparency Sort Mode but i cant find it in Edit > Project Settings > Graphics
Thanks for your Adive !
Answer by ChillinTech · Jan 20 at 08:17 PM
You can also just take URP off, change the setting, then add URP back on.
Answer by Kaldrin · Nov 26, 2020 at 02:09 PM
Hello @unity_qyNAJ9CdbDf9rw ! To set this up, you need to use the 2D rendering pipeline !
Create a 2D renderer pipeline asset and then assign it to the universal render pipeline asset you are using in the graphic settings ^^
Then you can set this up in the 2D pipeline asset ^^
Answer by Xenoram · Dec 14, 2020 at 07:17 PM
This was answered here: https://answers.unity.com/questions/1098203/sorting-layers-according-to-y-axis.html
Answer by Fuzzel_ · Dec 15, 2020 at 04:20 AM
Using URP the option is no longer in the Settings. You have to use a script.
Something like this:
#if UNITY_EDITOR
using UnityEditor;
#endif
using UnityEngine;
using UnityEngine.Rendering;
#if UNITY_EDITOR
[InitializeOnLoad]
#endif
public class TransparencySortGraphicsHelper
{
static TransparencySortGraphicsHelper()
{
OnLoad();
}
[RuntimeInitializeOnLoadMethod]
static void OnLoad()
{
GraphicsSettings.transparencySortMode = TransparencySortMode.CustomAxis;
GraphicsSettings.transparencySortAxis = new Vector3(0.0f, 0.0f, 1.0f);
}
}
Your answer
![](https://koobas.hobune.stream/wayback/20220613000320im_/https://answers.unity.com/themes/thub/images/avi.jpg)