Author Topic: Button scale changes after updating  (Read 1820 times)


  • Guest
Button scale changes after updating
« on: May 12, 2012, 03:06:40 PM »
This is a problem I got twice when updating NGUI, I did not see other posts mentionning it.
I have a few grids that I fill with instanciated prefabs of buttons. After the update, all those buttons are instanciated with a scale of (300,300,300) instead of (1,1,1).
I am not sure what causes this, the prefabs are fine as well as the rest of the widgets. I guess i will fix it by forcing the scale of the buttons manually after the instanciation...

(Edit: after debugging a bit, I noticed the scale change occurs after I set the parents to the button:
ButtonTexture.transform.parent = m_GridTextures.transform;
-> ButtonTexture.transform.localScale goes from (1,1,1) to (300,300,300)
I don't know enough about unity yet to understand why this happens though...)

« Last Edit: May 12, 2012, 03:14:17 PM by poulpator »


  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Button scale changes after updating
« Reply #1 on: May 12, 2012, 04:29:24 PM »
Use NGUITools.AddChild() to instantiate them, not Instantiate().


  • Guest
Re: Button scale changes after updating
« Reply #2 on: May 13, 2012, 02:36:47 AM »
Thanks, it works perfectly and the code looks much better too!