Hey, I wanted to know how I can achieve this with NGUI. I have 50 buttons on my menu. Each button will load a specific level in the game if it is clicked. But I don't want to write 50 different scripts relating to each button. This is my idea... but it's not working. Is there an easy way to go about doing this... like if "this button is clicked"?
using UnityEngine;
using System.Collections;
public class MenuButtonLoadLevel : MonoBehaviour {
public GameObject[] button;
void OnClick() {
if (button[0])
Application.LoadLevel(3);
if (button[1])
Application.LoadLevel(4);
if (button[2])
Application.LoadLevel(5);
if (button[3])
Application.LoadLevel(6);
if (button[4])
Application.LoadLevel(7);
if (button[5])
Application.LoadLevel(

;
}
}