namespace VRTK.Examples { using UnityEngine; using UnityEventHelper; public class ButtonReactor : MonoBehaviour { public GameObject go; public Transform dispenseLocation; private VRTK_Button_UnityEvents buttonEvents; private void Start() { buttonEvents = GetComponent(); if (buttonEvents == null) { buttonEvents = gameObject.AddComponent(); } buttonEvents.OnPushed.AddListener(handlePush); } private void handlePush(object sender, Control3DEventArgs e) { VRTK_Logger.Info("Pushed"); GameObject newGo = (GameObject)Instantiate(go, dispenseLocation.position, Quaternion.identity); Destroy(newGo, 10f); } } }