Author Topic: Confused about UIPanel and Sprite Behavior  (Read 8112 times)

BrienKing

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 5
    • View Profile
Confused about UIPanel and Sprite Behavior
« on: October 06, 2015, 04:45:03 AM »
I dropped a panel on the scene, plus a couple labels, text boxes, and buttons on it.

Since the panel doesn't have a Sprite property I decided to add a Sprite to it so I could have a background.

The problem is, is if I move the panel, the Sprite does not move with it.

The Anchoring of the Sprite appears to be on the Camera and not the Panel it's a child of even though the Target says my panel.

What am I doing wrong and is there a better way to do what I want?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Confused about UIPanel and Sprite Behavior
« Reply #1 on: October 07, 2015, 08:23:48 PM »
You can't add both sprite and panel components to the same game object.

Make your sprite a child of the panel.

BrienKing

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 5
    • View Profile
Re: Confused about UIPanel and Sprite Behavior
« Reply #2 on: October 07, 2015, 09:11:36 PM »
If you look at picture #2, you'll see that the Sprite is a child of the Panel.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Confused about UIPanel and Sprite Behavior
« Reply #3 on: October 10, 2015, 10:48:33 PM »
Ok, so you are anchoring a sprite to your panel, and the panel has no bounds -- this causes the sprite to be anchored to the screen. If you want it to move with the panel, check the "Offset" flag on the panel.