You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
520 B

5 years ago
  1. using UnityEngine;
  2. using System.Collections;
  3. namespace FogVolumeRenderPriority
  4. {
  5. [ExecuteInEditMode]
  6. public class RenderPriority : MonoBehaviour {
  7. public int DrawOrder = 0;
  8. public bool UpdateRealTime = false;
  9. // Use this for initialization
  10. void OnEnable () {
  11. gameObject.GetComponent<Renderer>().sortingOrder = DrawOrder;
  12. }
  13. // Update is called once per frame
  14. void Update () {
  15. if(UpdateRealTime)
  16. gameObject.GetComponent<Renderer>().sortingOrder = DrawOrder;
  17. }
  18. }
  19. }