How can i Click on a UI Button with a finger or anything with oculus rift i'm not sure if the rift relevant cause its like a collision i think at least like
using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.EventSystems;
public class OnButtonCollosion : MonoBehaviour {
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
private void OnCollisionEnter(Collision collision)
{
var pointer = new PointerEventData(EventSystem.current);
if (collision.transform.tag == "Button")
{
Debug.Log("Does Find BTN");
ExecuteEvents.Execute(collision.gameObject, pointer, ExecuteEvents.pointerEnterHandler);
}
}
private void OnTriggerStay(Collider other)
{
if (other.CompareTag("Hand"))
{
print("dsagfadsfadsfdsagsdagearswgsdgaew");
}
}
} //Like if i had a start button and i want to click the button when a finger(cube or something) touches it
Comment
Your answer
Follow this Question
Related Questions
How To input text from a button? 1 Answer
Smooth UI sprite animation. 1 Answer
What have I done wrong on the OnClick script from Creating a Main Menu tutorial? 0 Answers
How do I press an UI button with Gamepad controls? 0 Answers
Slide-Out Panel Animates on Button - How to Animate on Swipe Motion on Mobile? 1 Answer