Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Emulation for clicking button of uGUI
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class ButtonClickSimulator : MonoBehaviour {
[SerializeField] Button button;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
if (Input.GetKeyDown (KeyCode.E)) {
button.onClick.Invoke ();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment