Skip to content

Instantly share code, notes, and snippets.

@unitycoder
Created August 20, 2015 16:58
Show Gist options
  • Save unitycoder/07bf7fc9af13740b7d28 to your computer and use it in GitHub Desktop.
Save unitycoder/07bf7fc9af13740b7d28 to your computer and use it in GitHub Desktop.
SetSortingOrderAndLayer
using UnityEngine;
public class SetSortingOrderAndLayer : MonoBehaviour {
public int sortingOrder = 0;
public string layerName = "Default";
void Awake()
{
GetComponent<Renderer>().sortingOrder = sortingOrder;
GetComponent<Renderer>().sortingLayerName = layerName;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment