Author Topic: Resizing Sprites with UIDragResize script  (Read 1437 times)

blademaster

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 0
    • View Profile
Resizing Sprites with UIDragResize script
« on: December 29, 2014, 10:52:45 PM »
I am trying to allow user to resize sprite at runtime.
I added sprites for control as children to the target sprite as follows.

UI Root
 -Sprite
  -- BL (bottom left)
  -- BR
  -- TL
  -- TR (top right)
 
When I added the UIDragResize script to these controls,
The parent sprites can be resized properly but the controls(BL,BR,..) didn't  follow the mouse pointer(the attachment UIDragResize.jpg).

So I added the UIDragObject script to these controls.
This time, the controls move too much. (the attachment UIDragResize+UIDragObject.jpg)

How can I fix this issue?

My Unity Editor version is 4.6.0f3 and NGUI version is 3.7.6
I am trying this work at Web Player Platform, but I need to make this for both web and mobile(Android) platform.


Thank you.
-Han


ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Resizing Sprites with UIDragResize script
« Reply #1 on: December 30, 2014, 02:14:31 PM »
You need to anchor the corner sprites. If they're not anchored, they won't move properly. You should also ideally change the pivot point of the background to be top-left, not leave it centered.