Animation Settings


There are a number of settings which control playback of your animations.
Name
This is the name of the animation.  You can play animations using their names (case-sensitive) with code such as:

sprite.PlayAnim("name");

Though for performance reasons, it is recommended to use either a reference to the animation, or the index of the animation as string-comparison is comparatively slow. For more information, see Playing Animations.
Loop Cycles
The number of times the animation should be repeated in addition to its initial play-through.  For instance, if you want the animation to play only once, Loop Cycles should be set to 0.  If you want the animation to play a total of 3 times, Loop Cycles should be set to 2.  If you want the animation to loop infinitely, set Loop Cycles to -1.
Loop Reverse
When checked (set to true), the animation will reverse and play backward when it reaches the end in a sort of "ping-pong" fashion.  Note that when counting loop cycles, when Loop Reverse is enabled, a "cycle" is not counted until the animation returns to the beginning.
Framerate
This is the rate, in frames per second, at which the animation should play.
On Anim End
The setting of the onAnimEnd member determines what will happen when the animation ends.  There are three options:
  • Do Nothing - Leaves the sprite looking like the last frame in the animation.
  • Revert To Static - Returns the sprite to its static, non-animated texture.
  • Play Default Anim - Reverts to playing the animation referred to by the sprite's defaultAnim - normally used for the idle animation, for example.
  • Hide - Hides the sprite after the last frame of animation plays.
  • Deactivate - Deactivates (sometimes called disabling) the sprite's GameObject after the last frame of animation.
  • Destroy - Destroys the sprite's GameObject after the last frame of animation plays (calls Delete() internally).
Clips (ManualSprite only)
[ManualSprite only] This member only appears on animations in the ManualSprite class. Animations in the ManualSprite class are composed of multiple "clips", which define a series of sections (frames) on a pre-made atlas to play. See the next section for more info.
Anchor
How the sprite will be "anchored" relative to its center. Ex: if UPPER_LEFT is selected, the GameObject center will be at the upper-left corner of the sprite, and all sprite growth will take place downward and toward the right. TEXTURE_OFFSET is a special anchoring mode that centers the sprite relative to its GameObject's center according to how the sprite was centered in the original source texture.
Pixel Perfect
When enabled, the sprite will always be sized pixel-perfect at runtime. This means regardless of screen resolution, the sprite will always be drawn at its "native" size. Ex: a 32x32 sprite will always be drawn using 32x32 screen pixels, regardless of resolution. NOTE: If the object moves relative to a perspective camera, the sprite's/control's SetCamera() method will need to be called and passed a reference to the camera to ensure it updates its size to remain pixel-perfect at the new location.
Auto Resize
When changing states or animating (Requires SM2), the sprite's proportions will be automatically adjusted according to the original source texture, so that there is no warping or distortion.
Offset
Distance the sprite will be offset, in local space, from its GameObject's center.
Color
The color the sprite will be tinted. This can also be used to apply a fade to the sprite by changing the alpha.
Render Camera
The camera that will be used to render the sprite. If left empty, this will default to the main camera.
Hide At Start
When checked, the object will be hidden initially until it is unhidden by calling:
obj.Hide(false);
Text
Text that appears in the control's "control_text" child object, if any. When text is added to this field for the first time, a child GameObject with a SpriteText component is created using the default font specified in the scene's UIManager object's "Default Font" member. If no default font is set, no child GameObject or SpriteText will be created.
Sprite Text
Reference to the TextMesh component of the child GameObject that serves to display text associated with the control.
Text Offset Z
The distance along the Z-axis that the child SpriteText (if any) will be offset from the object itself to avoid depth-fighting.
Include Text In Auto Collider
When set to true, any automatically-generated collider for this control will take into account the extents of the child text object (if any). If you want the text to only be for show and not part of the control's clickable area, keep this set to false.
Data
(Only accessible in script.) A property that gets/sets a reference to a System.Object. This means you can assign anything to the Data property and retrieve it later. This is useful for associating relevant information to a control so that you can easily access it later.

Clips


Animations for the ManualSprite class are composed of one or more "clips", which define a series of frames to play from a pre-made atlas. The "Clips" member will appear in the inspector as an array. You must specify the number of clips in the given animation, and then fill in the details of each clip. Those details are described below:
Name
The name of the clip. Currently, this isn't used for much of anything, so this is not an important field.
Loop Cycles
The number of times the clip should be repeated in addition to its initial play-through before passing to the next clip.  For instance, if you want the clip to play only once, Loop Cycles should be set to 0.  If you want the clip to play a total of 3 times, Loop Cycles should be set to 2.  If you want the clip to loop infinitely, set Loop Cycles to -1, but if infinite looping is desired, it is recommended to set this in the animation instead of the clip.
Loop Reverse
When checked (set to true), the clip will reverse and play backward when it reaches the end in a sort of "ping-pong" fashion.  Note that when counting loop cycles, when Loop Reverse is enabled, a "cycle" is not counted until the clip returns to the beginning.
Start
This is the coordinate, in pixels, of the lower-left pixel of the first frame of the clip sequence. This value follows the same convention as the Lower Left Pixel setting in the ManualSprite class.
Pixels To Next Column And Row
The number of pixels from the Start position to the next column in the frame grid, and the number of pixels from the top of one row of frames in the grid to the next row down. Since frames should be arranged in a uniform grid, this is basically the width and height of each frame cell, in pixels.
Cols
The number of columns in the frame grid.
Rows
The number of rows in the frame grid.
Total Cells
The total number of cells in the grid of frames.
Anchor
How the sprite will be "anchored" relative to its center. Ex: if UPPER_LEFT is selected, the GameObject center will be at the upper-left corner of the sprite, and all sprite growth will take place downward and toward the right. TEXTURE_OFFSET is a special anchoring mode that centers the sprite relative to its GameObject's center according to how the sprite was centered in the original source texture.
Pixel Perfect
When enabled, the sprite will always be sized pixel-perfect at runtime. This means regardless of screen resolution, the sprite will always be drawn at its "native" size. Ex: a 32x32 sprite will always be drawn using 32x32 screen pixels, regardless of resolution. NOTE: If the object moves relative to a perspective camera, the sprite's/control's SetCamera() method will need to be called and passed a reference to the camera to ensure it updates its size to remain pixel-perfect at the new location.
Auto Resize
When changing states or animating (Requires SM2), the sprite's proportions will be automatically adjusted according to the original source texture, so that there is no warping or distortion.
Offset
Distance the sprite will be offset, in local space, from its GameObject's center.
Color
The color the sprite will be tinted. This can also be used to apply a fade to the sprite by changing the alpha.
Render Camera
The camera that will be used to render the sprite. If left empty, this will default to the main camera.
Hide At Start
When checked, the object will be hidden initially until it is unhidden by calling:
obj.Hide(false);
Text
Text that appears in the control's "control_text" child object, if any. When text is added to this field for the first time, a child GameObject with a SpriteText component is created using the default font specified in the scene's UIManager object's "Default Font" member. If no default font is set, no child GameObject or SpriteText will be created.
Sprite Text
Reference to the TextMesh component of the child GameObject that serves to display text associated with the control.
Text Offset Z
The distance along the Z-axis that the child SpriteText (if any) will be offset from the object itself to avoid depth-fighting.
Include Text In Auto Collider
When set to true, any automatically-generated collider for this control will take into account the extents of the child text object (if any). If you want the text to only be for show and not part of the control's clickable area, keep this set to false.
Data
(Only accessible in script.) A property that gets/sets a reference to a System.Object. This means you can assign anything to the Data property and retrieve it later. This is useful for associating relevant information to a control so that you can easily access it later.