Skip to content

Instantly share code, notes, and snippets.

@atiaxi
Last active September 12, 2016 19:04
Show Gist options
  • Save atiaxi/8ea3d624370caa52ce19c91120bb864b to your computer and use it in GitHub Desktop.
Save atiaxi/8ea3d624370caa52ce19c91120bb864b to your computer and use it in GitHub Desktop.
UNITY GUI:
One canvas. Its render mode is 'world space', it has a 1->100 canvas scaler and a graphic raycaster
Its transform is just where it is in world space
Its width and height appear to be 'pixel' width and heights, 300x500. This may be what the
world scaler is about.
But its transform also appears to have a scale factor of 0.005 (on all)
To make text pretty, up the 'Dynamic Pixels Per Unit' to e.g. 3
Attached to pointing controller:
Controller Events
SimplePointer
VRTK_UI Pointer
VRTK_Controller UI Pointer Events_Listener (for demo)
For text, 'overflow' is important; set to 'overflow' if you didnt give it enough space.
Buttons:
Make an object that has a script that has a callback (AFAICT, no args necessary, but you can supply them)
On button, drag that object into 'on click' and pick the script and callback.
Button text is a child of the button.
For a UI where you 'turn on' the pointer via a controller click, this will work out of the box.
For a UI where it's always on, a few changes:
On the simplepointer, disable teleport, change visibility to "always_on"
On the UI pointer, change activation mode to "always_on"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment