UIDragDropRoot.cs 363 B

123456789101112131415161718192021
  1. using System;
  2. using UnityEngine;
  3. [AddComponentMenu("NGUI/Interaction/Drag and Drop Root")]
  4. public class UIDragDropRoot : MonoBehaviour
  5. {
  6. private void OnEnable()
  7. {
  8. UIDragDropRoot.root = base.transform;
  9. }
  10. private void OnDisable()
  11. {
  12. if (UIDragDropRoot.root == base.transform)
  13. {
  14. UIDragDropRoot.root = null;
  15. }
  16. }
  17. public static Transform root;
  18. }