And I am using NGUI for my project and i don't know how to code a button created from NGUI button. The only code I know is.:
void OnMouseDown
Application.loadlevel(1);
But it's not working in NGUI button, i want to go to the next scene when the Start button is clicked. Can someone help me with these simple problem? I'm sorry for asking this small problem of mine, I'm just only a student and beginner, I hope you understand! thank you in advance.
For any UI elements from NGUI that need to react to user input, attach the NGUIButtonMessage script to the object. The object must have a collider in order for this script to work. In that script, you could tell it when to trigger it. Some examples are when you single click the object or when you just pressed it or released it. Then the next property of the script is the method or function name. That is the name of the method that you want to call in your script. The method name in your script must match what's on the method/function name field of the NGUIButton message. The last property is the trigger object. This is the object in which the script resides. For example if the method name that you want to handle the click in is called OnSubmitBttnClicked, and the target is the same game object which has the button message attached, there should be at least one script in that game object that contains a method with such name. Keep in mind if more than one method with the same name exist within the same object, all methods will get called. Here is an example of the method signature of the OnSubmitBttnClicked example:
You can also use
The level of protection does not matter. You could use private public or protected and it would still get called.
Hope this helps.