Author Topic: Out of Ratio when change sprite name [resolved]  (Read 5672 times)

weilies

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 21
    • View Profile
Out of Ratio when change sprite name [resolved]
« on: October 17, 2015, 08:51:39 PM »
i have a gameobject that will change to different image (in different sizes)
But once the sprite changed, it still keep to previous image size :(
it caused the image out of ratio

I know the 'snap' button will rectify the ratio. But what's the property to change in script? or how can i fix the component, to ensure everytime spritename changed, it will keep the perfect ratio?


Thanks for the help
« Last Edit: October 24, 2015, 08:06:48 AM by weilies »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Out of Ratio when change sprite name
« Reply #1 on: October 18, 2015, 06:48:20 PM »
Snap simply calls the MakePixelPerfect() function. You need to call it after changing the sprite.

weilies

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 21
    • View Profile
Re: Out of Ratio when change sprite name
« Reply #2 on: October 18, 2015, 07:06:08 PM »
Thanks,

Could u guide me through how to call the NGUI function in playmaker? I know it has to call from the specific gameobject but I just doesn't sure what's the exact script :p

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Out of Ratio when change sprite name
« Reply #3 on: October 24, 2015, 04:16:32 AM »
Sorry, I don't know Playmaker. You will need to ask their support.

weilies

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 21
    • View Profile
Re: Out of Ratio when change sprite name
« Reply #4 on: October 24, 2015, 08:06:28 AM »
I forgot to update the thread. I managed to make it worked!
Believe it or not, the Playmaker shown an Error while i put in the actions.

But in fact, it run smoothly and the error will never happen during run time.