Posts

Showing posts with the label functions

button UI event/functions

Clicking Buttons and having things happen. So, you're able to drag objects and create UI events in the Inspector..but I think this type of scripting is perhaps a bit quicker/precise? Code was lifted from the official Unity page. Make 3 button UI objects and add this script to an empty gameobject/or anything.   using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class button_tut : MonoBehaviour {     public Button _firstButton, _secondButton, _thirdButton;     //public Camera _cam;     public GameObject _cube;     // Start is called before the first frame update     void Start()     {        //setup various listener function things on the "onclick", per button         _firstButton.onClick.AddListener(TaskOnClick);         _secondButton.onCli...