Search Unity

Animation arrows not scaling with canvas

Discussion in 'UGUI & TextMesh Pro' started by ellenblomw, Sep 24, 2019.

  1. ellenblomw

    ellenblomw

    Joined:
    Mar 4, 2018
    Posts:
    153
    Hello,

    I am working on a tutorial where arrows point to different stuff in the UI during a voice tutorial. But when I switch resolution from 16:9 to 4:3 the arrows don't scale with the UI, so they end up on top of my buttons instead of pointing at them.

    The arrows are children to a gameobject with an animator, and they consist of UI images being setActive true/false during the tutorial. The animator is a child to the canvas, same canvas as my UI.

    How can I get them to position correctly no mather what aspect ratio? My UI buttons change place when I change aspect, but my arrows doesnt.

    //Ellen
     
  2. Antistone

    Antistone

    Joined:
    Feb 22, 2014
    Posts:
    2,836
    Sounds like this probably has to do with how your anchors are set.

    There's really no such thing as "not changing place" when you change aspect ratio. If the object stays the same distance from the corner, then it will be a different distance from the center, and vice versa. It's a question of what part of the screen the thing is "connected" to.

    You control that connection by how you set the object's anchors.

    Though you should also consider if it might be better to make your arrows children of the objects they point to; that way they'll always follow those objects no matter what you do with the objects themselves. (But depending on the details of your game, this might create hierarchical or Z-order issues that would give you a different set of annoyances...)
     
  3. ellenblomw

    ellenblomw

    Joined:
    Mar 4, 2018
    Posts:
    153
    Thanks, ok I will read up a little more on anchors so I understand them better. I can not make them children because then I'd have to have so many different animators :/.