in unity 4.3 you can apply the concept of sorting layer to 2d sprite
but how i can sort 2d sprite with 3d object???
i tried to change Z position but i always get the sprite drawn above 3d objects .
in unity 4.3 you can apply the concept of sorting layer to 2d sprite
but how i can sort 2d sprite with 3d object???
i tried to change Z position but i always get the sprite drawn above 3d objects .
i found the solution
you can set sorting layer name and sorting order for any 3d renderer using the following script
using UnityEngine;
using System.Collections;
public class SetSortingLayer : MonoBehaviour {
public string sortingLayerName; // The name of the sorting layer .
public int sortingOrder; //The sorting order
void Start ()
{
// Set the sorting layer and order.
renderer.sortingLayerName = sortingLayerName;
renderer.sortingOrder=sortingOrder;
}
}
this script already exists in unity 2d demo