Author Topic: I cloned sprite ,but it don't have same transform with it's model gameobject.Why  (Read 3831 times)

noob22

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 38
    • View Profile
I use "NGUITools.AddChild(Panel, Button);"
Panel is parent and Button is model gameobject.
Why a clone have a different transform with it's model gameobject?
How to clone a gameobject with the same transform by it's model gameobject?
And Suggestions?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
NGUITools.AddChild clears the transform to 0 0 0.

noob22

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 38
    • View Profile
NGUITools.AddChild clears the transform to 0 0 0.
I have got it!
GameObject g = NGUITools.AddChild(Panel, Button);
UISprite ui = g.GetComponent<UISprite>();
ui.MakePixelPerfect();
Thanks for your reply!