Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

[SOLVED] Image.fillAmount not working

Discussion in 'Scripting' started by welpie21, Jul 9, 2018.

  1. welpie21

    welpie21

    Joined:
    Dec 23, 2014
    Posts:
    49
    Hello everyone,

    since a few days im bussy making a project. and here i face a issue in unity it self or im just blind.
    when i want to update the UI with a function its calling it. but the fillAmount stays zero even with debugging. i tried doing fillAmount.Equals as '+=' and '='. but none of them worked.

    so here im posting my script. not to fancy but i hope someone can help me here.
    Code (CSharp):
    1. public void UpdateUI()
    2. {
    3.         if (drawer.container[drawer.index].answer == GetFieldText.ToLower())
    4.         {
    5.             images[1].fillAmount += 1 / ImageQueueLength;
    6.             images[2].fillAmount += 1 / ImageQueueLength;
    7.             Debug.Log(images[1].fillAmount);
    8.             Debug.Log(images[2].fillAmount);
    9.         }
    10.         else
    11.         {
    12.             images[0].fillAmount += 1 / ImageQueueLength;
    13.             images[2].fillAmount += 1 / ImageQueueLength;
    14.             Debug.Log(images[0].fillAmount);
    15.             Debug.Log(images[2].fillAmount);
    16.         }
    17. }
     
  2. welpie21

    welpie21

    Joined:
    Dec 23, 2014
    Posts:
    49
    fixed the issue. it caused problem by the ImageQueueLength. for a weird reason the ImageQueueLength contained 0 elements when there were 5 elements in the list.
     
  3. yuen9999

    yuen9999

    Joined:
    Jul 11, 2013
    Posts:
    1
    i work with unity2019.2. i can't find this varible image.fillAmount/image.type any more. which componet should i use? or use elder version unity?
     
    ahmetilhan282 likes this.