Home › Page › UghStretch

UghStretch

Inherits from MonoBehaviour

UghStretch will dynamically scale a GameObject in relation to two anchor points.  These anchor points can be UghSprites or generic screen anchor points.

Variables
name type description
constrainProportions boolean If the GameObject should maintain proportions when scaling.  (Defaults to false.)
IsDirty boolean True if the anchor points have been modified by an UghAlign but our GameObject has not been stretched.
point1Anchor UghSprite.Anchor The anchor location of the screen or corresponding UghSprite.
point1AnchorOffset Vector3 A custom offset from the corresponding anchor location.
point2Anchor UghSprite.Anchor The anchor location of the screen or corresponding UghSprite.
point2AnchorOffset Vector3 A custom offset from the corresponding anchor location.
stretchToPoint1 UghSprite An UghSprite anchor.  If null the screen will be used as the anchor.
stretchToPoint2 UghSprite An UghSprite anchor.  If null the screen will be used as the anchor.
stretchX boolean If the GameObject should be allowed to stretch in the X direction.
stretchY boolean If the GameObject should be allowed to stretch in the Y direction.
HandleMPDirtyAlign event Event called when this class executes the Align function.
AutoUpdate boolean If true, the Align function will be called when either anchor point is modified by an UghAlign. (Also during OnDrawGizmos.)  Defaults to true.
Functions
name type description
Align void Scales our GameObject in relation to our anchor points.

_

Using UghStretch in Script

public void Align()

This function will cause the class to stretch our GameObject.  During the Update event, if both IsDirty and AutoUpdate are true this function will be called.  (UghAlign will set IsDirty to true after aligning either anchor point.)  You must manually call this function if you have set AutoUpdate to false, or if either anchor point is moved by a means other than UghAlign.