Sorting Layers In Models 3D

Hello everyone

I have a 2D background and it is composed of several elements

and a 3D character circulating has it I want my character to go behind these elements

is this 2D technique supported for 3D models and how does it work

Yes. You can implement it a number of ways:

  1. make the 2D UI actually an in-world UI that goes behind the 3D player

OR

  1. make separate cameras and composite them one atop each other

OR

  1. use RenderTextures to “look at” your 3D characters and render them to 2D, then show them in the 2D UI

Entirely up to you for approach, as each has limitations and implications.

thanks a lot for your help

I tried to create a layer on my character and my UI environment on the default layer

then i try to write this script

public Camera cam ;

void Update () {
        if (Physics.Raycast (transform.position, Vector3.right, Mathf.Infinity)) {

            cam.cullingMask = 1 << 0;
       
        }
    }

I rather noticed that my person is deactivated from the launch of the game

because to put my character behind the UI his last lose their graphic resolution