using UnityEngine; using System.Collections; namespace FogVolumeRenderPriority { [ExecuteInEditMode] public class RenderPriority : MonoBehaviour { public int DrawOrder = 0; public bool UpdateRealTime = false; // Use this for initialization void OnEnable () { gameObject.GetComponent().sortingOrder = DrawOrder; } // Update is called once per frame void Update () { if(UpdateRealTime) gameObject.GetComponent().sortingOrder = DrawOrder; } } }