Skip to content

Instantly share code, notes, and snippets.

@bzgeb
Created February 20, 2014 19:23
Show Gist options
  • Save bzgeb/9121281 to your computer and use it in GitHub Desktop.
Save bzgeb/9121281 to your computer and use it in GitHub Desktop.
Set sorting layer component. Sets the sorting layer and order of any renderer, not just sprite renderers.
using UnityEngine;
using System.Collections;
public class SetSortingLayer : MonoBehaviour
{
public string sortingLayerName;
public int sortingLayerOrder;
void Start() {
renderer.sortingLayerName = sortingLayerName;
renderer.sortingOrder = sortingLayerOrder;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment