Search Unity

Feedback Updating text through script causes weird flick in the animation

Discussion in 'Scripting' started by pingerdot, Oct 16, 2019.

  1. pingerdot

    pingerdot

    Joined:
    Aug 19, 2019
    Posts:
    5
    https://hastebin.com/xuqekudede.cs

    Hey there, this has been bugging me for a day and I couldn't have figured out how to fix this issue.
    Basically I have an Input field and a text which is the (_ _ _ _ _ _) lines in the picture, and when a user types in the code if it's wrong it will play the animation and move the wrong code, but as you can see in the gyazo it gives kind of flicker and I'm pretty sure it's these two lines that are responsible for that

    Code (CSharp):
    1.  if (called)
    2.             {
    3.                 all.Remove(all[0]);
    4.                 all.Add("______");
    5.             }
    https://gyazo.com/2ddff7e124c976291b55fad0fc4094bf
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,700
    The flicker looks more like some other kind of layout/alignment artifact, like the total height of the text transiently changed for one frame, that caused it to shift, then the next frame it went back to the normal height.

    Do you have some layout mechanism on the text? Does the flicker go away if you temporarily disable that layout?
     
  3. pingerdot

    pingerdot

    Joined:
    Aug 19, 2019
    Posts:
    5
  4. pingerdot

    pingerdot

    Joined:
    Aug 19, 2019
    Posts:
    5