Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice

Progress Bar

Discussion in 'Immediate Mode GUI (IMGUI)' started by jan1984, Jul 29, 2008.

  1. jan1984

    jan1984

    Joined:
    May 30, 2008
    Posts:
    43
    Hi guys,
    i want to create a simple progress bar for my game.I looked into unity gui and came up across EditorUtility.DisplayProgressBar which seems to be something for the editor and not to be used inside the game actually.Is there something or will i have to write my own logic?
    Thx
     
  2. HiggyB

    HiggyB

    Unity Product Evangelist

    Joined:
    Dec 8, 2006
    Posts:
    6,183
    There is no built-in progress bar for use in the run-time engine, so you'll need to script one up on your own (which shouldn't be too hard).
     
  3. jan1984

    jan1984

    Joined:
    May 30, 2008
    Posts:
    43
    yup thats right.i jst wanted to see if there was already some hidden unity thing to use.by any chance cud u be remembering the math for range mapping.i need to map the percentage complete to the length of progress bar but i forgot the math.:(
    thx
     
  4. HiggyB

    HiggyB

    Unity Product Evangelist

    Joined:
    Dec 8, 2006
    Posts:
    6,183
    Perhaps you can share more details but in general, the pseudo-code looks like:

    - Determine the completion percentage of the operation in question (get a value between 0.0 and 1.0, 0.0 being just begun and 1.0 being complete).

    - To determine your progress bar width you multiply its maximum width (width at completion) by your progress percentage (current width = completion percentage x maximum width)