I loaded the model I made with Maya into Unity, but sorting layer doesn't work.

Asked 1 years ago, Updated 1 years ago, 37 views

I loaded the model I made with Maya into Unity, but sorting layer doesn't work.
Can I set the sorting layer except for sprites?

I look forward to your kind cooperation.

unity3d

2022-09-30 11:49

1 Answers

You can configure it by creating a script.
 
 The SpriteRenderer component that draws sprites has a SortingLayer configuration item on the Inspector, but the MeshRenderer and SkinnedMeshRenderer components do not have a SortingLayer configuration items on the Inspector.
 At first glance, the SortingLayer properties are not configurable, but the Render class, which is the base class of MeshRender and SkinnedMeshRender, has them, so you can configure them on the script.

class SampleClass—MonoBehavior
{
    SerializeField
    private string m_layerName="";

    void Start()
    {
        varrender=GetComponent<MeshRenderer>();
        if(render!=null)
        {
            render.sortingLayerName = m_layerName;
        }
    }
}

Please refer to the following article for a detailed explanation.
http://tsubakit1.hateblo.jp/entry/2015/01/05/233000


2022-09-30 11:49

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.