Closed junglee372018 closed 5 years ago
My quick suggestion to your problem should be have a flag to set to true when pointer entered, then in Update function, check for grip button pressed and the flag is true.
private bool isPointerEntered = false;
void Update() { if (ViveInput.GetPressDownEx(HandRole.RightHand, ControllerButton.Grip) && isPointerEntered) { Debug.Log("Grab button pressed true"); } }
public void OnPointerEnter(PointerEventData eventData) { Debug.Log("pointer enter true"); isPointerEntered = true; }
public void OnPointerExit(PointerEventData eventData) { Debug.Log("pointer exit true"); isPointerEntered = false; }
Hope this helps, cheers!
Hi chengnay,
Thank You for your reply. I have tried the above process suggested by you. but it is not working. i am not even getting pointer enter and exit logs. Is there any other way to do this?
You need to attach the script to the gameobject in the scene.
By taking the example UGUI, I attach the script the button,
Yeah did the same. But, I am trying to do this on gameobjects not UI.
Do you mind sending me a sample project that I can test on? Thanks!
I forgot to add "IPointerEnterHandler, IPointerExitHandler"
Now its working.
ThankYou very much
Hi, I want to keep pointer on a particular object and click grab button. Grab button click alone is working. when i want to perform grab button click by placing pointer on gameobject it is not working.
my code is like this public void PointerEnter(PointerEventData eventData) { Debug.Log("pointer enter true"); if (ViveInput.GetPressDownEx (HandRole.RightHand, ControllerButton.Grip)) { Debug.Log ("Grab button pressed true"); } }
Kindly help me in getting this solved.
I am using Unity v2018.1.8f1 and VIU v1.9.0