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了。

posted on 2015-12-29 17:01  萨瓦迪卡麦兜兜  阅读(442)  评论(0编辑  收藏  举报

导航