ProgressBar

From Unify Community Wiki
(Difference between revisions)
Jump to: navigation, search
(Created page with "== What is it == A simple circular progress bar for 2D Sprites, or on a 3D quad. == Demo == http://www.youtube.com/watch?v=y8RLVuoq0AU == Code == <syntaxhighlight lang="c...")

Revision as of 01:04, 17 February 2014

Contents

What is it

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

Demo

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

Code

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

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.
Personal tools
Namespaces

Variants
Actions
Navigation
Extras
Toolbox