Search Unity

Image position not updating.

Discussion in 'UGUI & TextMesh Pro' started by danp, Sep 19, 2017.

  1. danp

    danp

    Joined:
    Jun 20, 2013
    Posts:
    21
    I'm updating the position of a panel via script. If I set the panel to active then set the position at the same time this happens.




    Here the rec transform is in the correct position (the white square outline) but the image on the panel is in the old position (black square).

    If it is already active and I set the position then everything updates correctly.

    How can I get the image to update when setting the position?
     
    DmytroTkhoruk likes this.
  2. Xialya

    Xialya

    Joined:
    Oct 4, 2015
    Posts:
    52
    Got the same issue, and did not find any way to fix it.
    It only appeared after upgrading from 5.x to Unity 2017.
     
  3. saki

    saki

    Joined:
    Aug 12, 2014
    Posts:
    8
    :( The same problem that I encountered may also be.
    I use 2017.1.2f1.
     
  4. zeantblaze

    zeantblaze

    Joined:
    Dec 2, 2014
    Posts:
    3
    Similar problem but with the source image. It's not updating when I set the sprite to something else when the parent object is not active (the source image in inspector is correct though)
     
  5. sergienko88

    sergienko88

    Joined:
    Jul 22, 2013
    Posts:
    22
    try like this
    _panel.anchoredPosition3D = new Vector3(_panel.anchoredPosition3D.x, _panel.anchoredPosition3D.y, 0);
    ...
    _panel.anchoredPosition3D = new Vector3(_panel.anchoredPosition3D.x, _panel.anchoredPosition3D.y, .1f);
    it works for me
     
  6. BenGoze

    BenGoze

    Joined:
    Feb 18, 2019
    Posts:
    6