ShowTipTime.cs 746 B

12345678910111213141516171819202122232425262728293031323334353637
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. public class ShowTipTime : MonoBehaviour
  5. {
  6. public float TimeFloat = 10;
  7. // Start is called before the first frame update
  8. void Start()
  9. {
  10. }
  11. private void OnEnable()
  12. {
  13. t = 0;
  14. }
  15. private void OnDisable()
  16. {
  17. t = 0;
  18. TimeFloat = 10;
  19. }
  20. public float t;
  21. // Update is called once per frame
  22. void Update()
  23. {
  24. t = t + Time.deltaTime;
  25. if(t>TimeFloat)
  26. {
  27. this.gameObject.SetActive(false);
  28. }
  29. this.transform.position = OpenXRCamera.Instance.head.position;
  30. this.transform.eulerAngles = OpenXRCamera.Instance.head.eulerAngles;
  31. }
  32. }