- Home /
CustomAxis sort not working between objects placed at different layers rendered by multiple cameras
I'm working on a 2D top down game and I'm using TransparencySortMode as CustomAxis so that objects are sorted to the back as they go up in Y. This used to work fine,even when objects were placed at various layers. But now I've added a second camera which is used for post processing effects. This second camera renders a layer called post process objects which contains all the objects that are supposed to be rendered by this camera. The post process is correctly being applied to this layer but the custom axis sorting no longer works between the objects rendered by this camera and the objects rendered by the main camera.The post process camera(2nd camera) has its clear flags set to depth only and is at a depth higher than the main camera.The objects rendered by this second camera are always rendered on top of the objects rendered by the main camera.The custom axis sorting is ignored.If I place the post process camera at a lower depth than the main camera then the objects are rendered below the objects rendered by the main camera, once again ignoring the custom axis sort.I'm using Unity 2018.2.7f1 by the way. So I'm in a fix right now. So my question is basically this-How do I render objects placed at different layers with multiple cameras and also make the CustomAxis sort work?