Search Unity

Unity UI Weird UI positioning bug

Discussion in 'UGUI & TextMesh Pro' started by vincent-savysoda, Jul 24, 2017.

  1. vincent-savysoda

    vincent-savysoda

    Joined:
    Dec 19, 2016
    Posts:
    33
    So I recently encountered a weird bug with positioning UI objects that hasn't occured anywhere else. In my project, I had a script that repositioned a UI object during runtime whenever a button is clicked. This worked properly the FIRST time, but for some reason after that the repositioning stops working VISUALLY, even though its actual position data has been correctly set! (e.g. UI Object A is moved to UI Object B's x position. Inspector shows that it has successfully been moved, but in both scene and game views UI Object A hasn't moved at all)

    I have attached a screenshot of the problem, where you can see the panel selected in the Scene view but it's actual visual position hasn't been updated:

    Screen Shot 2017-07-24 at 11.46.34 AM.png

    Has anyone else encountered this problem?
     
  2. vincent-savysoda

    vincent-savysoda

    Joined:
    Dec 19, 2016
    Posts:
    33
    OK, I've found a workaround solution to this. Basically what happens is that everytime before i can click a button to reposition the panel as seen above, I have to click once to deactivate the panel. The bug here seems to occur if I do the repositioning BEFORE I reactivate it. Once I switched that around to do the repositioning after activating the object, it worked perfectly fine.