Introduction
Transform Renderer is renderer that allows you to indicate progress using position translate, scale, or rotation of texture object in 2D space. The most common usage of this renderer is to create speedometers, clocks, or other kinds of gauges.
Usage
You can create new uGUI Transform Renderer in three ways:
- Select Game Object → UI → Energy Bar Toolkit → Transform Bar from the main menu
- Select Tools → Energy Bar Toolkit → uGUI → Create Transform Bar from the main menu
- Click on the button in Hierarchy window, then UI → Energy Bar Toolkit → Transform Bar
You should see the result immediately:
Configuration
In order to make things easier, Inspector of Energy Bar Sequence Renderer is split to 5 different sections.
Textures
Here you can setup your textures.
You are allowed to add any number of background and foreground sprites. To add a new sprite just click the + (add) button and you can remove it by selecting it and then pressing the - (remove) button. For each texture you can also decide about its tint. The tint of the Bar texture is configurable in the Appearance section.
- Background Textures – These sprites will be placed under the Bar texture.
- Object Texture – The texture of object that will be transformed. It can be later set to move, rotate, and scale.
- Object Pivot – The pivot point of this texture from 0 to 1. The default is 0.5, 0.5 which means the center of this texture.
- Foreground Textures (optional) – These sprites will be placed on top of the Bar texture.
Appearance
Here you can setup how your bar should appear to the user (except textures setup).
- Set Native Size – Click on this button to resize your bar to it’s native size based on used sprites.
- Label – Choose the uGUI Text object to be used as your bar label.
- Label Format – Format of the label. See description below.
Object Transform
This is most unique part of transform renderer. It decides how Texture Object should be transformed through time (progress).
- Translate – If enabled the object position will be translated.
- Start Point – Translation start point. 0, 0 is always center of texture. Coordinates are normalized so -0.5, -0.5 is top-left corner.
- End Point – Translation end point.
- Rotate – If enabled the object rotation will be changed.
- Start Angle – Start angle in degrees counter-wise.
- End Angle – End angle in degrees counter-wise.
- Scale – If enabled the object scale will be changed.
- Start Scale – Local scale start value.
- End Scale – Local scale end value.
Effects
Makes the bar smoothly change its value.
- Speed – Effect speed.
- Direction – When the smooth effect should be visible. The options are Only When Decreasing, Only When Increasing, and _Both.
- On Finished – Specify a object that message should be sent to, when the smooth effect finishes its animation. After assigning the object, you will be able to specify the method name as well.
Debug
The debug section exists for mainly for debugging purposes. If you’re advanced Unity user and/or you will be having troubles of understanding the workings of Energy Bar Toolkit, then enable the debug mode. In debug mode Energy Bar Toolkit reveals all hidden game objects, that normally shouldn’t be seen or modified.