YIUIGameObjectEntityRef.cs 816 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. using System;
  2. using Sirenix.OdinInspector;
  3. using UnityEngine;
  4. namespace ET
  5. {
  6. [DisallowMultipleComponent]
  7. [AddComponentMenu("")]
  8. public partial class YIUIGameObjectEntityRef : MonoBehaviour
  9. {
  10. public EntityRef<Entity> EntityRef;
  11. public Entity Entity => EntityRef;
  12. #if ENABLE_VIEW && UNITY_EDITOR
  13. [NonSerialized]
  14. private GameObject m_ViewGO;
  15. [PropertyOrder(int.MinValue)]
  16. [ReadOnly]
  17. [ShowInInspector]
  18. [HideInEditorMode]
  19. [LabelText("ViewGO")]
  20. public GameObject ViewGO
  21. {
  22. get
  23. {
  24. if (m_ViewGO == null)
  25. {
  26. m_ViewGO = Entity?.ViewGO;
  27. }
  28. return m_ViewGO;
  29. }
  30. }
  31. #endif
  32. }
  33. }