0
点赞
收藏
分享

微信扫一扫

Hololens2开发学习-点击按钮弹出对话框或slate

开源分享 2022-04-14 阅读 84
c#unity

1.在导航栏Mixed Reality----Toolkit---ToolBox中选择按钮或者菜单。

2.对话框制体制作,在自定义编辑好你的面板后,拖入Assets/Resources文件夹,如果没有则新建Resources。

3.为按钮绑定代码文件

public class duihauk : MonoBehaviour
{
  public GameObject obj1;//实例化对象
    // Start is called before the first frame update
    void Start()
    {
        
    }

    // Update is called once per frame
    void Update()
    {
        
    }
    public void Clickthis()
    {
        GameObject obj = Resources.Load<GameObject>("slate(Clone)");
        Instantiate(obj);
        Destroy(obj1);//完场对话框弹出后,销毁。
       

    }
}
4.将代码挂在按钮上,在按钮的basic event上绑定

 

举报

相关推荐

0 条评论