[英]How to create a menu form with different buttons from a unity sprite without using NGUI
I want to create a main menu in Unity3d for which I have taken a sprite as main menu window and many small sprites as buttons. 我想在Unity3d中创建一个主菜单,为此,我将一个精灵作为主菜单窗口,并将许多小的精灵作为按钮。 I wish to write a script that I want to attach to my main menu and that will detect which button is clicked and what function to call.
我希望编写一个脚本,并将其附加到主菜单,该脚本将检测单击了哪个按钮以及要调用的函数。 But I don't know how to do that.
但是我不知道该怎么做。 Can anybody help me?
有谁能够帮助我?
I think the quickest option would be to display the sprites and add a "OnMouseDown()" script, you only need a collider on it. 我认为最快的选择是显示精灵并添加“ OnMouseDown()”脚本,您只需要一个对撞机即可。
More information: OnMouseDown() 详细信息: OnMouseDown()
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.