1. ให้ทำการสร้าง Sub Menu ขึ้นมานะครับ ในตัวอย่างผมจะสร้าง Panel ก่อนและจากนั้นก็ทำการสร้าง ปุ่มใน Panel อีกที ตามรูปครับ
public void DisplaySubMenu(GameObject subMenu)
{
subMenu.SetActive(true);
}
จากเดิมเรียกใช้ SetScene ให้เปลี่ยนเป็น DisplaySubMenu แล้วทำ Set Parameter เป็น SubMenuPanel
GameObject = ปุ่ม PRESS START BUTTON หรือ Parent ของปุ่ม
Function = GameObject.SetActive
Parameter = false
GameObject = Scritp TitleUIController.cs GameObject
Function = TitleUIController.SetScene
Parameter = ชื่อ Scene
6. จากนั้นให้ทำการ Add Even Trigger Component ให้กับ ปุ่ม (Component -> Event -> Event Trigger)
7. จากนั้นกด Add New Event Type และให้ทำการ Add Pointer Enter และ Pointer Exit ดังรูป
public void SetMouseOverColor(GameObject obj)
{
obj.GetComponent<Text>().color = Color.yellow;
}
public void SetMouseExitColor(GameObject obj)
{
obj.GetComponent<Text>().color = Color.white;
}
GameObject = Script TitleUIController.cs GameObject
Function = TitleUIController.SetMouseOverColor
Parameter = ปุ่ม START GAME
10. ในส่วนของ Pointer Enter ให้ทำการคลิกปุ่ม + แล้วทำการ Set
GameObject = Script TitleUIController.cs GameObject
Function = TitleUIController.SetMouseExitColor
Parameter = ปุ่ม START GAME
จากนั้นให้ทำการ Play Game ดูครับ เมื่อเอา Mouse ไปว่างตัวอักษรก็จะเปลี่ยนสี
เท่านี้ก็สามารถนำไปประยุกต์ใช้งานได้แล้วครับ
ปล. มีอะไรแนะนำมาได้นะครับ