MeshRendererOrder.cs 354 B

12345678910111213141516171819
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. [ExecuteInEditMode]
  5. public class MeshRendererOrder : MonoBehaviour
  6. {
  7. public int Order;
  8. void OnEnable()
  9. {
  10. GetComponent<Renderer>().sortingOrder = Order;
  11. }
  12. void OnValidate()
  13. {
  14. GetComponent<Renderer>().sortingOrder = Order;
  15. }
  16. }