Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Handles class compatibility w/ EditorVR

Discussion in 'EditorXR' started by TexasGreenTea, Jan 1, 2017.

  1. TexasGreenTea

    TexasGreenTea

    Joined:
    Dec 26, 2016
    Posts:
    12
    I'm trying to use Handles.ArrowCap. My arrows are rendering to scene view as expected but they don't render to the HMD in EditorVR. I assume the same problem will be true for anything that normally renders via OnSceneGUI in an Editor script.

    EditorVR seems to be rendering to the HMD via a camera component. It seems like the HMD thinks it's looking at a game view even though it's actually intended to be a scene view.

    Anyone know of a quick way to get Handles working in EditorVR?
     
  2. amirebrahimi_unity

    amirebrahimi_unity

    Unity Technologies

    Joined:
    Aug 12, 2015
    Posts:
    400
    You're correct - normal OnSceneGUI will not work. It's possible to hook OnSceneGUI with VRView.onGUIDelegate, but I just tried using Handles and they aren't rendering and I don't know of a workaround at the moment. I'm not sure yet whether it makes sense to have Handles work in EditorVR as it was designed to work with an EditorWindow and mouse pointer. If you feel strongly about getting this support added, then you can submit a feature request that others can vote up.
     
  3. TexasGreenTea

    TexasGreenTea

    Joined:
    Dec 26, 2016
    Posts:
    12
    In order to create great EVR tools, we'll need ways to draw UI elements attached to our hands but also to any objects in the scene. It makes sense that the Handles class would be weird in EVR, but in that case I think we need something else to accomplish the task of rendering stuff into scene view without cluttering the user's existing game objects with extra components.

    Tools seem to be the VR equivalent of OnSceneGUI and workspaces seem to be the VR equivalent of EditorWindows, so I hope we'll eventually be able to use tools & workspaces to accomplish all the things we can already do in 2D via OnSceneGUI & EditorWindows.

    Temporarily, I used line renderers to draw lines between objects, but that solution doesn't really hold water for any object that should have a line renderer anyway. I thought about using the Graphics class, but there's no DrawLine function as far as I know, so I guess I'd have to procedurally generate each line as a mesh and then use DrawMesh. If anyone else can think of a better workaround, I'd very much appreciate your input.