AutoDisable.cs 462 B

1234567891011121314151617181920
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.Events;
  5. public class AutoDisable : MonoBehaviour {
  6. [SerializeField] private PlayTween m_PlayTween = null;
  7. [SerializeField] float m_DelayTime = 3.0f;
  8. private void OnEnable() {
  9. Invoke("DisableMyself", m_DelayTime);
  10. }
  11. private void DisableMyself() {
  12. if (m_PlayTween != null)
  13. m_PlayTween.PlayReverse();
  14. }
  15. }