Hello Guest

Author Topic: center sprite  (Read 4033 times)

aaron7090

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 11
    • View Profile
center sprite
« on: November 04, 2013, 01:17:31 am »
Is it possible to center a button or sprite inside a uilayout with no code? Also if this is possible is it possible to center + offset?

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: center sprite
« Reply #1 on: November 04, 2013, 12:58:31 pm »
Create a game object, add a sprite as a child to that game object.
In the uilayout, set the game object anchors to all 4 sides. That will centre the game object, and indirectly the sprite underneath it. If you need to offset the sprite, simply move it, independently to the child.

aaron7090

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 11
    • View Profile
Re: center sprite
« Reply #2 on: November 05, 2013, 04:12:39 am »
it worked, thanks!  :D