练习时长两年半的Programmer 2022-03-15 16:17 采纳率: 81.5%
浏览 40
已结题

一个关于unity的问题,希望有回答

我想要的效果:点击“彩蛋”按钮打开愤怒的小鸟.exe,但是运行后点击不知道为啥不可以
Button

img

Button的代码

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class ButtonEvent : MonoBehaviour
{
    // Start is called before the first frame update
    void Start()
    {
        
    }

    // Update is called once per frame
    void Update()
    {
        
    }
    void OnClick()
    {
        string url = Application.dataPath + "/愤怒的小鸟.exe"; 
        Application.OpenURL(url); //打开
    }
}

  • 写回答

2条回答 默认 最新

  • 有点朦 2022-03-16 11:40
    关注

    img

    
        public void OnClick()
        {
            print("点击、、、、");
        }
    

    img

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

问题事件

  • 系统已结题 3月28日
  • 已采纳回答 3月20日
  • 创建了问题 3月15日