27 lines
519 B
C#
27 lines
519 B
C#
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class Web : MonoBehaviour
|
|
{
|
|
[Header("UI")]
|
|
public Button targetButton;
|
|
|
|
[Header("網址")]
|
|
public string targetUrl = "www.youtube.com/watch?v=dQw4w9WgXcQ";
|
|
|
|
void Start()
|
|
{
|
|
if (targetButton != null)
|
|
{
|
|
targetButton.onClick.AddListener(OnButtonClicked);
|
|
}
|
|
}
|
|
|
|
void OnButtonClicked()
|
|
{
|
|
if (!string.IsNullOrEmpty(targetUrl))
|
|
{
|
|
Application.OpenURL(targetUrl);
|
|
}
|
|
}
|
|
} |