using UnityEngine;
using System.Collections;
Using UnityEngine. SceneManagement;
//
Public class UI: MonoBehaviour {
Void the Start () {
}
Void the Update () {
}
Void OnButtonClick () {
SceneManager. LoadScene (" 12 ");
}
}
Method is the script to the additional game object STARTUI into the game of Onclick
So no response, press the button or the original scene
But if I put OnButtonClick () the function in the Start () or Update () began to run just jump straight to 12 this scene inside
To solve the
CodePudding user response:
Object up, still have to specify your function, do not specify a function, the unity which don't know what do you want to perform the functionCodePudding user response:
Dynamically add AddListenerCodePudding user response:
You don't have to monitor events, is to use NGUI or UGUI, NGUI need to add BoxCollider, UGUI painting directly dragging or add AddlistenerCodePudding user response:
With a click eventCodePudding user response:
Using AddListener add listening? Or on the Unity panel Button Button to add a click event, will you write the Button event method binding to it? As a good, the two methods have?CodePudding user response:
Button need to add click on listening, advice or to understand the script of the meaning of the life cycle and every method to do it,,,CodePudding user response:
You click no callback, you can add the callback function under the button click eventCodePudding user response:
Are you bound method?CodePudding user response:
Direct the OnClick (); On line, click on the Button,