Author Topic: Anchor Bug?  (Read 1778 times)

vidjogamer

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 48
    • View Profile
Anchor Bug?
« on: April 18, 2014, 10:29:42 AM »
Hello, I am trying to use an advanced anchor to position 3 sides of a widget to the sides of a screen, the 4th side is supposed to be variable based on a game object. I figured this was the perfect time to use anchors. But the anchors are not behaving as I would expect.

Ive attached some images that hopefully demonstrate what is happening. the right side of my widget is anchored to a sphere in the scene. I expect the widget to resize to the spheres position when I move my sphere around. Instead when I drag the sphere around, the right side of my widget just kinda bounces around pseudo randomly.

vidjogamer

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 48
    • View Profile
Re: Anchor Bug?
« Reply #1 on: April 18, 2014, 11:00:34 AM »
So it seems to work properly if the anchor object has a component derived from UIWidget. This will work. Are empty game objects not supposed to work?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Anchor Bug?
« Reply #2 on: April 18, 2014, 04:33:50 PM »
Empty game object works fine. Note the difference in layers. Game objects on the "default" layer are drawn by a different camera, so their position on the screen isn't the same as your UI objects.

When you create a widget, it's forced onto the UI layer.