Author Topic: UIPanel 'snapping' to position when moved in code  (Read 2715 times)

danthat

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 4
    • View Profile
UIPanel 'snapping' to position when moved in code
« on: February 10, 2014, 07:07:15 AM »
I have a "Marker" object. It's a UIPanel, with a child UISprite and UILabel, being drawn in world space. The panel object's position is moved manually in a circle around the player, to point at a target object.

Code itself works fine, but something in nGUI is forcing the panel to 'snap' to a grid, and I cant find where. NGUI->Options->Snapping is off.

What's causing this jerky, jump behaviour? It only happens in nGUI panels, not other types of in-world sprite.

Ta,

@danthat

danthat

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 4
    • View Profile
Re: UIPanel 'snapping' to position when moved in code
« Reply #1 on: February 10, 2014, 07:10:52 AM »
Typical, fixed it within seconds of asking for help.

Problem was the objects were on a GUI layer. I made a new one called "InWorldGUI", and shifted them to that and it seems to work fine.

Is there some sort of default setting for layers called "GUI"?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UIPanel 'snapping' to position when moved in code
« Reply #2 on: February 10, 2014, 05:08:16 PM »
The snapping option is for moving the widgets in the scene view -- they can snap to the edges of others.

If you're doing world GUI, make sure that it's drawn using the main camera, not the UI camera. UICamera event handling is set to "UI" rather than "World" by default, which changes certain behaviour.