OpenURLOnClick.cs 377 B

123456789101112131415161718
  1. using System;
  2. using UnityEngine;
  3. public class OpenURLOnClick : MonoBehaviour
  4. {
  5. private void OnClick()
  6. {
  7. UILabel component = base.GetComponent<UILabel>();
  8. if (component != null)
  9. {
  10. string urlAtPosition = component.GetUrlAtPosition(UICamera.lastWorldPosition);
  11. if (!string.IsNullOrEmpty(urlAtPosition))
  12. {
  13. Application.OpenURL(urlAtPosition);
  14. }
  15. }
  16. }
  17. }