Scene_TooltipMenu_ShowMenu.cs 905 B

1234567891011121314151617181920212223242526272829303132333435
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using UnityEngine;
  5. public class Scene_TooltipMenu_ShowMenu : MonoBehaviour
  6. {
  7. private GameObject _tooltipMenu;
  8. private GameObject tooltipMenu;
  9. private void Start()
  10. {
  11. _tooltipMenu = Resources.Load<GameObject>("Prefabs/TooltipMenu");
  12. }
  13. public void ShowTooltipMenu()
  14. {
  15. try
  16. {
  17. if (tooltipMenu != null)
  18. {
  19. Destroy(tooltipMenu);
  20. }
  21. else
  22. {
  23. Vector3 locate = transform.position;
  24. locate.y -= 0.05f;
  25. Quaternion rotation = transform.rotation;
  26. tooltipMenu = Instantiate(_tooltipMenu, locate, rotation);
  27. }
  28. }
  29. catch (Exception e)
  30. {
  31. Debug.Log(e.Message);
  32. }
  33. }
  34. }