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.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

2D Lightweight Render Pipeline + Camera settings not working

Discussion in '2D' started by notzimo, Jan 6, 2020.

  1. notzimo

    notzimo

    Joined:
    Dec 16, 2019
    Posts:
    3
    Hey
    My project is in 2D from a top down view, so i used Transparency Sort Mode -> Custom Mode(0, 0, 1).
    Then I added a Render Pipeline for 2D Lighting and stuff and the camera settings disappeared and didn't work anymore.
    Is there a way to customize the Camera Transparency Sort Mode without removing the Render Pipeline 2D?
    Thank u!
    Timo
     
  2. Chris-Trueman

    Chris-Trueman

    Joined:
    Oct 10, 2014
    Posts:
    1,256
    You have to change it via code, I had the same issue.

    Code (CSharp):
    1. Camera.main.transparencySortMode = TransparencySortMode.CustomAxis;
    2. Camera.main.transparencySortAxis = new Vector3(0f, 0f, 1f);
     
    MachinatioVitae and notzimo like this.
  3. notzimo

    notzimo

    Joined:
    Dec 16, 2019
    Posts:
    3
    where should I put this code?
     
  4. Chris-Trueman

    Chris-Trueman

    Joined:
    Oct 10, 2014
    Posts:
    1,256
    In any script that loads when the scene is loaded so it affects the camera for that scene. I put it in its own script in Awake and attached it to the camera in the scene.
     
    MachinatioVitae and notzimo like this.
  5. Chris-Trueman

    Chris-Trueman

    Joined:
    Oct 10, 2014
    Posts:
    1,256
    For those coming here for an answer, Unity has added these settings to the SRP asset to effect all camera's globally. If you only want it per camera the above code will work fine.