Unity做PC的时候,如果对于一些简单的提示框没有过多要求,可以调用Windows系统对话框
效果如下:
代码很简单
public class DllTest
{
[DllImport("User32.dll", SetLastError = true, ThrowOnUnmappableChar = true, CharSet = CharSet.Auto)]
public static extern int MessageBox(IntPtr handle, String message, String title, int type);
}
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Test : MonoBehaviour {
// Use this for initialization
void Start ()
{
DllTest.MessageBox(IntPtr.Zero, "这是一个提示", "这是一个测试", 0);
}
}
当然网上还有MessageBox.Show这种方法,小伙伴们自行选择即可