World UI

From PowerUI
Revision as of 16:02, 13 January 2017 by 151.229.186.156 (talk) (Created page with "World UI's are for any UI that needs to appear in 3D space. They come in two flavours: == Ordinary World UI == These are true 3D and are typically what you'd use if you wan...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

World UI's are for any UI that needs to appear in 3D space. They come in two flavours:


Ordinary World UI

These are true 3D and are typically what you'd use if you want to make use of the text-extrude CSS property. If you want to make one in the editor, go to:

GameObject > UI > PowerUI > In World UI

You'll then get a previewer which will show you where the UI will appear. Note that the "WorldUI Helper" component is intended to be more of a guideline so it's reccommended to take a look at the source.

Typically they're instanced dynamically anyway (such as for 3D chat bubbles etc) so for that you'll want to look at the WorldUI scripting class.


Flat World UI

These are your more traditional in world UI's where it's rendered to an image, then the image is displayed in the gameworld however you wish. They are slower than ordinary WorldUI's because of that extra texture step, but they are a lot more flexible in terms of how they can be displayed. As the surface can be literally any shape, they require slightly specialized input handling. Fortunately PowerUI contains everything you need, so it's just a case of this:

// FlatWorldUI myFlatWorldUI;

// Set the transform property to the transform of whichever gameobject is displaying the texture@
myFlatWorldUI.transform=theTransform;

// Mark it as accepting input next (must happen after the above):
myFlatWorldUI.AcceptsInput=true;