A world UI is one which can be placed in a particular spot in the game world and seen with the game camera. For example, an in-game computer screen/ billboard etc. It has a pixel height and width, a document (which works just like UI.document does) and can have its resolution and origin changed. The resolution defines how many pixels make up one world unit and the origin defines where the gameobjects origin is relative to the UI. By default, it's in the middle.
Public Member Functions | |
WorldUI () | |
Creates a new World UI with 100x100 pixels of space and a name of "new World UI". The gameobjects origin sits at the middle of the UI by default. See PowerUI.WorldUI.SetOrigin. By default, 100 pixels are 1 world unit. See PowerUI.WorldUI.SetResolution. More... | |
WorldUI (string name) | |
Creates a new World UI with 100x100 pixels of space and the given name. The gameobjects origin sits at the middle of the UI by default. See PowerUI.WorldUI.SetOrigin. By default, 100 pixels are 1 world unit. See PowerUI.WorldUI.SetResolution. More... | |
WorldUI (int widthPX, int heightPX) | |
Creates a new World UI with the given pixels of space and a name of "new World UI". The gameobjects origin sits at the middle of the UI by default. See PowerUI.WorldUI.SetOrigin. By default, 100 pixels are 1 world unit. See PowerUI.WorldUI.SetResolution. More... | |
WorldUI (string name, int widthPX, int heightPX) | |
Creates a new World UI with the given pixels of space and a given name. The gameobjects origin sits at the middle of the UI by default. See PowerUI.WorldUI.SetOrigin. By default, 100 pixels are 1 world unit. See PowerUI.WorldUI.SetResolution. More... | |
void | CameraChanged () |
Call this if you change the field of view of the camera looking at a pixel perfect WorldUI. More... | |
void | UpdateResolution () |
Flushes resolution changes. Use this after a set resolution method if you want to see your changes on the next update. Note that this is not needed when you've just created your WorldUI or if you're also changing any innerHTML or styles at the same time. Internally this just generates a layout request. More... | |
void | SetInputMode (InputMode mode) |
Called when the input mode changes. This makes sure all active batches are set to the correct mode (i.e. physics or screen). Default is None. More... | |
virtual void | RenderWithCamera (int id) |
Puts all batches of this renderer into the given unity layer. More... | |
void | SetDepthResolution (float gaps) |
Sets how many world units are used between elements at different depths. Default is 0.01. You'll generally want this to be as small as possible to make the UI appear flat. Too small though and you'll get z-fighting. You can also use large values if you want to achieve a unique effect. More... | |
void | SetResolution (int ppw) |
Sets how many Pixels Per World unit this renderer uses. Maps directly to applying a scale. Default is 100. The actual world space size is dictated by this and PowerUI.WorldUI.SetDimensions. The amount of pixels and pixels per world unit (resolution). More... | |
void | SetResolution (float ppw) |
Sets how many Pixels Per World unit this renderer uses. Maps directly to applying a scale. Default is 100. The actual world space size is dictated by this and PowerUI.WorldUI.SetDimensions. The amount of pixels and pixels per world unit (resolution). More... | |
void | SetResolution (int ppwW, int ppwH) |
Sets how many Pixels Per World unit this renderer uses, allowing for distortion. Maps directly to applying a scale. Default is 100 on each axis. The actual world space size is dictated by this and PowerUI.WorldUI.SetDimensions. The amount of pixels and pixels per world unit (resolution). More... | |
virtual void | SetDimensions (int widthPX, int heightPX) |
Sets how many pixels of space this renderer has. The actual world space size is dictated by this and PowerUI.WorldUI.SetResolution. The amount of pixels and pixels per world unit (resolution). More... | |
void | SetOrigin (float x, float y) |
Sets the location of the gameobjects origin relatively. More... | |
void | FaceCamera (Camera cameraToFace) |
Makes this UI always face the given camera. More... | |
void | FaceCamera () |
Makes this UI face the main camera until told to stop. Note that this only needs to be called once. More... | |
void | StopFacingCamera () |
Stops making this UI face a camera. More... | |
void | Update () |
Updates this UI. Called internally by UI.Update. More... | |
void | ParentToOrigin (Transform parent) |
Parents this WorldUI to the given gameobject and then moves it to the transforms origin. More... | |
void | ParentToOrigin (GameObject parent) |
Parents this WorldUI to the given gameobject and then moves it to the gameobjects origin. More... | |
void | GotoLocalOrigin () |
Moves this world UI so it's at the origin of it's parents transform. More... | |
void | Expire () |
Expires this WorldUI now. More... | |
void | CancelExpiry () |
Cancels a pending expiry. More... | |
void | SetExpiry (float expiry) |
Sets an expiry time for this WorldUI. It will be destroyed in this many seconds. More... | |
void | Destroy () |
Destroys this UI. Note that this also occurs if the gameobject is destroyed; Just destroying the gameobject or a parent gameObject is all that is required. More... | |
Static Public Member Functions | |
static void | UpdateAll () |
Updates all worldUI's. Called internally to update pixel perfect WorldUI's. More... | |
static WorldUI | Find (string name) |
Finds a WorldUI by name. Note that this is a linear scan so it's very wise to keep hold of references to your WorldUI's where possible. If multiple WorldUI's have the same name, the latest one created is returned. More... | |
Public Attributes | |
int | pixelWidth |
The width of the UI in pixels. More... | |
int | pixelHeight |
The height of the UI in pixels. More... | |
Document | document |
The HTML document for this UI. Use this to edit the content. More... | |
Transform | transform |
The world space transform of the UI. Use this to move it around. More... | |
GameObject | gameObject |
The game object that this UI is parented to. More... | |
string | Name |
The name of this WorldUI. Use WorldUI.Find to obtain a WorldUI by name. More... | |
bool | Expires |
Does this WorldUI expire? More... | |
float | ExpiresIn |
How long until this worldUI expires. More... | |
WorldUI | UIAfter |
For internal use. All WorldUI's are stored as a linked list for updates. This is the next one in the list. More... | |
WorldUI | UIBefore |
For internal use. All WorldUI's are stored as a linked list for updates. This is the one before this in the list. More... | |
float | PixelHeightF |
The height of the UI in pixels as a float. More... | |
Renderman | Renderer |
The renderer that renders this UI. More... | |
Camera | CameraToFace |
The camera to look at. Camera.main is used if this is null and AlwaysFaceCamera is true. More... | |
bool | AlwaysFaceCamera |
<sumamry>True if this UI should face the main camera. More... | |
WorldUIExpiryEvent | OnExpire |
An event called when this WorldUI expires. Returning false prevents the default destroy action. More... | |
Vector2 | WorldScreenOrigin =Vector2.zero |
The location of the origin in pixels. Set internally; see PowerUI.WorldUI.SetOrigin. More... | |
Vector2 | OriginLocation =new Vector2(0.5f,0.5f) |
The location of the gameobjects origin relatively. Set internally; see PowerUI.WorldUI.SetOrigin. More... | |
int | AtlasSize |
Static Public Attributes | |
static Dictionary< Transform, WorldUI > | PhysicsLookup |
A lookup used to quickly find a WorldUI from its transform. Used for physics based input resolving. More... | |
static bool | LiveUpdatablesAvailable |
True if any of the live WorldUI's are 'updateable'. These are pixel perfect or ones which are facing a camera. More... | |
Properties | |
bool | PixelPerfect [get, set] |
True if the resolution of this WorldUI is automatically updated such that the UI is always pixel perfect. More... | |
RenderMode | RenderMode [get, set] |
How this WorldUI renders images; either on an atlas or with them 'as is'. Default is Atlas. More... | |
int | Layer [get, set] |
The layer to put this worldUI in. More... | |
Transform | PhysicsModeCollider [get] |
The collider's transform if WorldUI's are in Screen input mode. This will have a BoxCollider attached. More... | |
Vector2 | WorldPerPixel [get] |
The amount of world units per pixel. This is just the transform scale. More... | |
Vector2 | WorldScreenSize [get] |
The size of the screen in world units. More... | |
FilterMode | TextFilterMode [get, set] |
Sets the text filter mode. Note: shared fonts will be affected in all other UI's. More... | |
Private Member Functions | |
void | MainScreenSizeChanged () |
Called when the game screen changes size. Used by pixel perfect WorldUI's. More... | |
void | CameraToFaceChanged () |
Called when CameraToFace changes by calling a FaceCamera overload. More... | |
Private Attributes | |
bool | IsPixelPerfect |
True if the resolution of this WorldUI is automatically updated such that the UI is always pixel perfect. More... | |
float | ScreenSpaceProportion |
Cached percentage of the screen that a pixel perfect WorldUI should take up. More... | |
|
inline |
Creates a new World UI with 100x100 pixels of space and a name of "new World UI". The gameobjects origin sits at the middle of the UI by default. See PowerUI.WorldUI.SetOrigin. By default, 100 pixels are 1 world unit. See PowerUI.WorldUI.SetResolution.
|
inline |
Creates a new World UI with 100x100 pixels of space and the given name. The gameobjects origin sits at the middle of the UI by default. See PowerUI.WorldUI.SetOrigin. By default, 100 pixels are 1 world unit. See PowerUI.WorldUI.SetResolution.
name | The name for the UI's gameobject. |
|
inline |
Creates a new World UI with the given pixels of space and a name of "new World UI". The gameobjects origin sits at the middle of the UI by default. See PowerUI.WorldUI.SetOrigin. By default, 100 pixels are 1 world unit. See PowerUI.WorldUI.SetResolution.
|
inline |
Creates a new World UI with the given pixels of space and a given name. The gameobjects origin sits at the middle of the UI by default. See PowerUI.WorldUI.SetOrigin. By default, 100 pixels are 1 world unit. See PowerUI.WorldUI.SetResolution.
|
inline |
Call this if you change the field of view of the camera looking at a pixel perfect WorldUI.
|
inlineprivate |
Called when CameraToFace changes by calling a FaceCamera overload.
|
inline |
Cancels a pending expiry.
|
inline |
Destroys this UI. Note that this also occurs if the gameobject is destroyed; Just destroying the gameobject or a parent gameObject is all that is required.
|
inline |
Expires this WorldUI now.
|
inline |
Makes this UI always face the given camera.
cameraToFace | The camera to face. |
|
inline |
Makes this UI face the main camera until told to stop. Note that this only needs to be called once.
|
inlinestatic |
Finds a WorldUI by name. Note that this is a linear scan so it's very wise to keep hold of references to your WorldUI's where possible. If multiple WorldUI's have the same name, the latest one created is returned.
name | The WorldUI's name. |
|
inline |
Moves this world UI so it's at the origin of it's parents transform.
|
inlineprivate |
Called when the game screen changes size. Used by pixel perfect WorldUI's.
|
inline |
Parents this WorldUI to the given gameobject and then moves it to the transforms origin.
parent | The transform to parent to. |
|
inline |
Parents this WorldUI to the given gameobject and then moves it to the gameobjects origin.
parent | The gameobject to parent to. |
|
inlinevirtual |
Puts all batches of this renderer into the given unity layer.
id | The ID of the unity layer. |
Reimplemented in PowerUI.FlatWorldUI.
|
inline |
Sets how many world units are used between elements at different depths. Default is 0.01. You'll generally want this to be as small as possible to make the UI appear flat. Too small though and you'll get z-fighting. You can also use large values if you want to achieve a unique effect.
gaps | The distance between elements to use. |
|
inlinevirtual |
Sets how many pixels of space this renderer has. The actual world space size is dictated by this and PowerUI.WorldUI.SetResolution. The amount of pixels and pixels per world unit (resolution).
widthPX | The width in pixels. |
heightPX | The height in pixels. |
Reimplemented in PowerUI.FlatWorldUI.
|
inline |
Sets an expiry time for this WorldUI. It will be destroyed in this many seconds.
|
inline |
Called when the input mode changes. This makes sure all active batches are set to the correct mode (i.e. physics or screen). Default is None.
mode | The new mode to use. |
|
inline |
Sets the location of the gameobjects origin relatively.
x | The x coordinate of the origin as a value from 0->1. Zero is the left edge. Default 0.5. |
y | The y coordinate of the origin as a value from 0->1. Zero is the bottom edge. Default is 0.5. |
|
inline |
Sets how many Pixels Per World unit this renderer uses. Maps directly to applying a scale. Default is 100. The actual world space size is dictated by this and PowerUI.WorldUI.SetDimensions. The amount of pixels and pixels per world unit (resolution).
ppw | Pixels per world unit to use for both x and y. |
|
inline |
Sets how many Pixels Per World unit this renderer uses. Maps directly to applying a scale. Default is 100. The actual world space size is dictated by this and PowerUI.WorldUI.SetDimensions. The amount of pixels and pixels per world unit (resolution).
ppw | Pixels per world unit to use for both x and y. |
|
inline |
Sets how many Pixels Per World unit this renderer uses, allowing for distortion. Maps directly to applying a scale. Default is 100 on each axis. The actual world space size is dictated by this and PowerUI.WorldUI.SetDimensions. The amount of pixels and pixels per world unit (resolution).
ppwW | Pixels per world unit to use for the x axis. |
ppwH | Pixels per world unit to use for the y axis. |
|
inline |
Stops making this UI face a camera.
|
inline |
Updates this UI. Called internally by UI.Update.
|
inlinestatic |
Updates all worldUI's. Called internally to update pixel perfect WorldUI's.
|
inline |
Flushes resolution changes. Use this after a set resolution method if you want to see your changes on the next update. Note that this is not needed when you've just created your WorldUI or if you're also changing any innerHTML or styles at the same time. Internally this just generates a layout request.
bool PowerUI.WorldUI.AlwaysFaceCamera |
<sumamry>True if this UI should face the main camera.
int PowerUI.WorldUI.AtlasSize |
Camera PowerUI.WorldUI.CameraToFace |
The camera to look at. Camera.main is used if this is null and AlwaysFaceCamera is true.
bool PowerUI.WorldUI.Expires |
Does this WorldUI expire?
float PowerUI.WorldUI.ExpiresIn |
How long until this worldUI expires.
GameObject PowerUI.WorldUI.gameObject |
The game object that this UI is parented to.
|
private |
|
static |
True if any of the live WorldUI's are 'updateable'. These are pixel perfect or ones which are facing a camera.
string PowerUI.WorldUI.Name |
The name of this WorldUI. Use WorldUI.Find to obtain a WorldUI by name.
WorldUIExpiryEvent PowerUI.WorldUI.OnExpire |
An event called when this WorldUI expires. Returning false prevents the default destroy action.
Vector2 PowerUI.WorldUI.OriginLocation =new Vector2(0.5f,0.5f) |
The location of the gameobjects origin relatively. Set internally; see PowerUI.WorldUI.SetOrigin.
|
static |
A lookup used to quickly find a WorldUI from its transform. Used for physics based input resolving.
int PowerUI.WorldUI.pixelHeight |
The height of the UI in pixels.
float PowerUI.WorldUI.PixelHeightF |
The height of the UI in pixels as a float.
int PowerUI.WorldUI.pixelWidth |
The width of the UI in pixels.
|
private |
Cached percentage of the screen that a pixel perfect WorldUI should take up.
Transform PowerUI.WorldUI.transform |
The world space transform of the UI. Use this to move it around.
WorldUI PowerUI.WorldUI.UIAfter |
For internal use. All WorldUI's are stored as a linked list for updates. This is the next one in the list.
WorldUI PowerUI.WorldUI.UIBefore |
For internal use. All WorldUI's are stored as a linked list for updates. This is the one before this in the list.
Vector2 PowerUI.WorldUI.WorldScreenOrigin =Vector2.zero |
The location of the origin in pixels. Set internally; see PowerUI.WorldUI.SetOrigin.
|
getset |
The layer to put this worldUI in.
|
get |
The collider's transform if WorldUI's are in Screen input mode. This will have a BoxCollider attached.
|
getset |
|
getset |
How this WorldUI renders images; either on an atlas or with them 'as is'. Default is Atlas.
|
getset |
Sets the text filter mode. Note: shared fonts will be affected in all other UI's.
|
get |
The amount of world units per pixel. This is just the transform scale.
|
get |
The size of the screen in world units.