Question by 
               Deadshot1994 · Oct 16, 2015 at 12:33 PM · 
                2dmeshrenderersorting layerssorting order  
              
 
              Adding a sorting layer and order in layer to a mesh renderer
I have a 3D object (cube) with a mesh renderer and I want it to be on the same layer as all my other items, I've added a script in which I input the layer and order but the object is still rendered on top of everything else. How do I modify it to just appear on one specific layer?
Thanks.
               Comment
              
 
               
              Your question is written a bit wierd. I dont understand what you are trying. Could you post your script? Then I can see clearer what you are trying.
 using UnityEngine;
 using System.Collections;
 
 //[ExecuteInEdit$$anonymous$$ode]
 public class RendererTest : $$anonymous$$onoBehaviour {
 
     public Renderer cubeRenderer;
     public string sortLayerTest;
     public int orderInLayerTest;
     
     // Use this for initialization
     void Start () {
         if (cubeRenderer== null) {
             cubeRenderer= this.GetComponent<Renderer>();
         }
         SetLayer();
     }
     
     
     public void SetLayer() {
         if (cubeRenderer== null) {
             cubeRenderer= this.GetComponent<Renderer>();
         }
         
         cubeRenderer.sortingLayerName = sortLayerTest;
         cubeRenderer.sortingOrder = orderInLayerTestr;
         
         Debug.Log(cubeRenderer.sortingLayerName + " " + cubeRenderer.sortingOrder);
     }
     
 }
 
                   So this is basically a code, I have a main character set in the ForeGroundLayer, and a canvas set on BackGroundLayer, I've tried everything but the objects is always rendered on top of everything.
Your answer