QuadUI 1.2.9 public beta
Run-time API for QuadUI

Quad2D Class Reference

List of all members.

Public Member Functions

void UV (Vector2 topLeftPixel)
void Scale (Vector3 scale)
void MovePosition (Vector3 position)
void MovePosition (Vector3 position, bool isLocal)
Vector3 GetScale ()
Vector3 GetPosition ()
void Tint (Color color)
void SetAlpha (float alpha)
void RejoinBatch ()

Properties

new Collider collider [get]
new MeshRenderer renderer [get]
bool visible [get, set]
Vector2 dimensions [get]
Color tint [get, set]

Detailed Description

This class is sealed an cannot be extended.

This class is your communication to the Quad mesh. Though you can still communicate with the Renderer and Collider components, this class has functions for performing common operations. This class invokes RequireComponent on MeshFilter and MeshRenderer.

Note: The MeshFilter, MeshRenderer and MeshCollider components are cached internally on Awake(), so communicating with them through this class is faster than using renderer or collider in any other attached script.


Member Function Documentation

Vector3 Quad2D.GetPosition ( )

Short-cut to getting Transform.localPosition of the quad. Note: This is localPosition because of the nature of how Quad's are typically placed - nested inside of Game Objects.

Vector3 Quad2D.GetScale ( )

Short-cut to getting Transform.localScale of the quad.

void Quad2D.MovePosition ( Vector3  position)

Short-cut to setting Transform.localPosition of the quad. Has one overload with the option to specify if position should be assigned to Transform.localPosition

void Quad2D.MovePosition ( Vector3  position,
bool  isLocal 
)
void Quad2D.RejoinBatch ( )

If you have modified the material in any way to make it different from the sharedMaterial, this will set the quad's material back to its sharedMaterial. This is very useful if you are keeping a tight draw call budget!

void Quad2D.Scale ( Vector3  scale)

Short-cut to setting Transform.localScale of the quad.

void Quad2D.SetAlpha ( float  alpha)

Short-cut to setting the alpha value of Renderer.material.color of the quad.

void Quad2D.Tint ( Color  color)

Short-cut to setting Renderer.material.color of the quad.

void Quad2D.UV ( Vector2  topLeftPixel)

Takes a Point2D, the top-left coordinate of the UV map.

Note: we use Point2D instead of Vector2 because Vectors support floats, but Point2D forces int. This prevents fractional pixels.


Property Documentation

new Collider Quad2D.collider [get]

Read only. Returns the cached Collider or null if there is none. Faster than using MonoBehaviour.collider in an attached script.

Vector2 Quad2D.dimensions [get]

Read only. Returns the width and height of the Quad as a Vector2.

new MeshRenderer Quad2D.renderer [get]

Read only. Returns the cached MeshRenderer. Faster than using MonoBehaviour.renderer in an attached script.

Color Quad2D.tint [get, set]

Short-cut to getting/setting Renderer.material.color of the quad.

bool Quad2D.visible [get, set]

Enables/Disables attached MeshRenderer. Use this instead of manually toggling MeshRenderer.enabled.

 All Classes Functions Variables Enumerations Properties