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...")
 
(Instructions)
Line 24: Line 24:
 
*Use progress texture in the material  
 
*Use progress texture in the material  
 
*Use code above, or something like it in a script.
 
*Use code above, or something like it in a script.
 +
 +
== Resources ==
 +
 +
[http://wiki.unity3d.com/index.php/File:Trans-slider-2.png Transparent Progress Bar Slider]

Revision as of 01:08, 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.

Resources

Transparent Progress Bar Slider

Personal tools
Namespaces

Variants
Actions
Navigation
Extras
Toolbox