Application.OpenURL()
给大家推荐一个触控按钮直接跳转到指定网址的
上代码
using UnityEngine; using System.Collections; using TouchScript.Gestures; public class ApplicationONE : MonoBehaviour { string path = "http://www.cnblogs.com/unitySPK/"; // Use this for initialization void OnEnable () { this.GetComponent<PressGesture>().Pressed += ApplicationONE_Pressed; } void ApplicationONE_Pressed(object sender, System.EventArgs e) { Application.OpenURL(path); } // Update is called once per frame void OnDisable () { this.GetComponent<PressGesture>().Pressed -= ApplicationONE_Pressed; } }
那个OnEnable和OnDisable中的是一个添加点击的事件,用的是一个触屏插件TouchScript插件,这个插件挺好用的,下次给大家分享一下在项目如何运用的。
最主要的代码就是一个指定的路径Path
然后直接App了 OK了。
【推荐】还在用 ECharts 开发大屏?试试这款永久免费的开源 BI 工具!
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步