Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Reticle stuck on UI

Discussion in 'Daydream' started by duncangroberts, Feb 24, 2017.

  1. duncangroberts

    duncangroberts

    Joined:
    Jul 22, 2015
    Posts:
    69
    Hi there,
    I'm currently working on a game that requires a UI element for a dialogue piece. I'm using pixel crushers dialogue system and nearly have it working but in between responses the reticle of the laser detaches from the laser itself and gets stuck on the UI. I've replaced the raycasters in the standard prefabs to gvrpointergraphics raycasters and this works apart from the said issue. Does anyone have any idea why this may be?
    Thanks,
    Duncan
     
  2. dsternfeld

    dsternfeld

    Official Google Employee

    Joined:
    Jan 3, 2017
    Posts:
    72
    Hello!

    I've never used Pixel Crushers Dialogue system, do you still see this same issue when using Unity's UI elements on their own?

    Can you upload a video or photo of the issue to help me understand what is going on?

    Thanks,

    Dan
     
  3. duncangroberts

    duncangroberts

    Joined:
    Jul 22, 2015
    Posts:
    69
    Hey @dsternfeld ! Thanks for getting back to me,

    Here is a quick video showing the issue. The change I have made to the canvas of the dialogue manager is to replace the standard graphics raycaster with e the GVRpointerGraphicraycaster. Hope this helps and thank you for all you help!



    Duncan
     
  4. duncangroberts

    duncangroberts

    Joined:
    Jul 22, 2015
    Posts:
    69
    Ps I have seen this issue before with unity's standard UI, I resolved it by replacing the standard raycaster with the gvr one but this didn't work here. I'm a bit stumped so any help is very much appreciated!
    Duncan
     
  5. dsternfeld

    dsternfeld

    Official Google Employee

    Joined:
    Jan 3, 2017
    Posts:
    72
    Thanks Duncan!

    Is it possible that there is a standard raycaster that is getting added dynamically while that transition occurs? You could type "t:GraphicRaycaster" in the search bar of the Hierarchy window and see if anything appears during the transition.

    Also, can you add the following debug code to line 219 of GvrPointerInputModule?

    Code (csharp):
    1.  
    2. if (raycastResult.gameObject != null) {
    3.   Debug.Log("Hit Object: " + raycastResult.gameObject.ToString() + ", Raycaster: " + raycastResult.module.GetType());
    4. } else {
    5.   Debug.Log("Hit Nothing.");
    6. }
    7.  
    I'd like to see what it output during the time where this behavior is occurring.

    Thanks,

    Dan
     
  6. duncangroberts

    duncangroberts

    Joined:
    Jul 22, 2015
    Posts:
    69
    Thanks Dan,

    Unfortunately there doesnt appear to be another instance of a graphicraycaster being created during the transition. The search doesnt throw up anything. Adding the code you suggest below shows the following outputs when hitting nothing, then it appears to be hitting a background object then the label. I've tried disabling raycast target for these objects with no joy:
    Code (CSharp):
    1. Hit Nothing.
    2. UnityEngine.Debug:Log(Object)
    3. GvrPointerInputModule:CastRay() (at Assets/GoogleVR/Scripts/EventSystem/GvrPointerInputModule.cs:225)
    4. GvrPointerInputModule:process() (at Assets/GoogleVR/Scripts/EventSystem/GvrPointerInputModule.cs:144)
    5. UnityEngine.EventSystems.EventSystem:Update()
    6.  
    7. Hit Object: Background (UnityEngine.GameObject), Raycaster: GvrPointerGraphicRaycaster
    8. UnityEngine.Debug:Log(Object)
    9. GvrPointerInputModule:CastRay() (at Assets/GoogleVR/Scripts/EventSystem/GvrPointerInputModule.cs:221)
    10. GvrPointerInputModule:process() (at Assets/GoogleVR/Scripts/EventSystem/GvrPointerInputModule.cs:144)
    11. UnityEngine.EventSystems.EventSystem:Update()
    12.  
    13. Hit Object: Label (UnityEngine.GameObject), Raycaster: GvrPointerGraphicRaycaster
    14. UnityEngine.Debug:Log(Object)
    15. GvrPointerInputModule:CastRay() (at Assets/GoogleVR/Scripts/EventSystem/GvrPointerInputModule.cs:221)
    16. GvrPointerInputModule:process() (at Assets/GoogleVR/Scripts/EventSystem/GvrPointerInputModule.cs:144)
    17. UnityEngine.EventSystems.EventSystem:Update()
    I've created a small unitypackage to show the issue. Sorry for the hassle and thanks for your help so far @dsternfeld

    Duncan
     

    Attached Files:

  7. duncangroberts

    duncangroberts

    Joined:
    Jul 22, 2015
    Posts:
    69
    Hi sorry, one more point on this.
    I've found that this isn't actually related to the dialogue system asset (which is V good by the way).

    I created a simple scene with a canvas and a button and added three event triggers, for onpointerenter, exit and click. The onenter and onexit triggers worked fine, they changed the colour of the button, however when clicking I called a function to destroy the button and then the issue arises.

    The reticle becomes detached from the laser and locks in place, however looking in the scene view there still seems to be some rotation related to the orientation of the controller, it just doesn't move in relation to the laser. Hope that helps! I must be doing something very wrong!

    Thanks!

    Duncan
     
  8. dsternfeld

    dsternfeld

    Official Google Employee

    Joined:
    Jan 3, 2017
    Posts:
    72
    Thanks for the additional info Duncan, it was very helpful! I believe I understand what is causing this now.

    The issue is caused by a bug in GvrPointerInputModule that occurs when a GameObject is destroyed while it is being pointed at. It has already been fixed for the next release of the Unity GVR SDK. Below is the modification that must be made to GvrPointerInputModule to fix it in the meantime.

    Replace lines 273-285 of GvrPointerInputModule with the following code:
    Code (csharp):
    1.  
    2. if (isPointerHovering && currentObject != null && currentObject == previousObject) {
    3.   pointer.OnPointerHover(currentObject, intersectionPosition, GetLastRay(), isInteractive);
    4. } else {
    5.   // If the object's don't match or the hovering object has been destroyed
    6.   // then the pointer has exited.
    7.   if (previousObject != null || (currentObject == null && isPointerHovering)) {
    8.     pointer.OnPointerExit(previousObject);
    9.     isPointerHovering = false;
    10.   }
    11.  
    12.   if (currentObject != null) {
    13.     pointer.OnPointerEnter(currentObject, intersectionPosition, GetLastRay(), isInteractive);
    14.     isPointerHovering = true;
    15.   }
    16. }
    17.  
    Add the following member variable to the GvrPointerInputModule class:
    Code (csharp):
    1.  
    2. private bool isPointerHovering = false;
    3.  
    Thanks,

    Dan
     
    pfreema1 likes this.
  9. duncangroberts

    duncangroberts

    Joined:
    Jul 22, 2015
    Posts:
    69
    Dan!

    You are such a legend, that's worked perfectly! Thank you so so much, I massively appreciate it.

    Duncan
     
  10. cvasquez-coiron

    cvasquez-coiron

    Joined:
    Nov 10, 2014
    Posts:
    22
    It looks like this has been fixed in Google VR Unity SDK version 1.3, GVRPointerInputModule.cs, lines [64], [296-310]
     
  11. tepo01

    tepo01

    Joined:
    Nov 4, 2016
    Posts:
    1
    I reproduced the issue in Unity 5.6.0f3 even though the GVR SDK has those updates in the GVRPointerInputModule.cs file.
     
  12. dsternfeld

    dsternfeld

    Official Google Employee

    Joined:
    Jan 3, 2017
    Posts:
    72
    Hey Tepo01!

    Can you please provide a simple sample project that reproduces the issue with the latest SDK in Unity 5.6.0f3?

    Thanks,

    Dan
     
    JLauchlan likes this.
  13. JLauchlan

    JLauchlan

    Joined:
    Oct 14, 2014
    Posts:
    1
    Managed to reproduce this issue on Unity 2017 V3. Resolved by scaling down the size of the target sphere. I found the Target Sphere was colliding with the camera when the player moved from point to point.