ProgressBar

From Unify Community Wiki
(Difference between revisions)
Jump to: navigation, search
(Instructions)
(What is it)
 
Line 1: Line 1:
 
== What is it ==
 
== What is it ==
  
A simple circular progress bar for 2D Sprites, or on a 3D quad.
+
A simple circular progress bar for 2D Sprites, or on a 3D quad, by [[User:Opless|Opless]].
  
 
== Demo ==
 
== Demo ==

Latest revision as of 01:17, 17 February 2014

Contents

[edit] What is it

A simple circular progress bar for 2D Sprites, or on a 3D quad, by Opless.

[edit] Demo

http://www.youtube.com/watch?v=y8RLVuoq0AU

[edit] Code

void Update() {
	float revealOffset = (float)(Time.timeSinceLevelLoad % 10) / 10.1F; 
 
	gameObject.renderer.material.SetFloat ("_Cutoff", revealOffset);
}

[edit] Instructions

  • Create your circular progress bar image with an alpha gradient (N.B. it can be ANY shape)
  • Set the import to be a texture (not a sprite) and DO NOT USE COMPRESSION.
  • Create a material with the shader being "Transparent Cutout Vertex Lit"
  • Use progress texture in the material
  • Use code above, or something like it in a script, attach it to the Quad/Sprite.
  • 2D Only - Use material and set it on the sprite, remember it'll ignore all but the size of the sprite.
  • REMEMBER - This is using a cutout shader, so you'll need something behind it if you want it coloured.

[edit] Resources

Transparent Progress Bar Slider

Personal tools
Namespaces

Variants
Actions
Navigation
Extras
Toolbox