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. 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.
More information: OnMouseDown()
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.