Author Topic: space between the sprite / NGUI  (Read 2270 times)

kikuchi

  • Guest
space between the sprite / NGUI
« on: October 01, 2012, 10:25:20 PM »
Hi,

I am trying to display an object of sprite using the three.
Input correct pixel, scale, but space between the sprite on the iPhone.

  1. Parent = (GameObject)Instantiate( ParentPrefab,new Vector3(0,0,0),Quaternion.identity);
  2. Parent.transform.parent = UIRootPanel.transform;
  3. Parent.transform.localScale = new Vector3(1.0f,1.0f,1.0f);
  4. Parent.transform.localPosition = new Vector3(0.0f,0.0f,0.0f);
  5.  
  6. GameObject child_1 = Parent.transform.FindChild("Child_1").gameObject; // sprite from atlas
  7. child_1.transform.localScale = new Vector3(58.0f, 64.0f, 1.0f);
  8. child_1.transform.localPosition = new Vector3(0.0f, 100.0f, 1.0f);
  9.  
  10. GameObject child_2 = Parent.transform.FindChild("Child_2").gameObject; // sprite from atlas
  11. child_2.transform.localScale = new Vector3(15.0f, 64.0f, 1.0f);
  12. child_2.transform.localPosition = new Vector3(58.0f, 100.0f, 1.0f);
  13.  
  14. GameObject child_3 = Parent.transform.FindChild("Child_3").gameObject; // sprite from atlas
  15. child_3.transform.localScale = new Vector3(34.0f, 64.0f, 1.0f);
  16. child_3.transform.localPosition = new Vector3(73.0f, 100.0f, 1.0f);
  17.  

How do does it work?

Thanks.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: space between the sprite / NGUI
« Reply #1 on: October 01, 2012, 11:52:03 PM »
I'm lost and confused by the code. What's with all the hard-coded numbers? Have you tried simply using a UITable?

kikuchi

  • Guest
Re: space between the sprite / NGUI
« Reply #2 on: October 02, 2012, 07:33:10 AM »
I want to display a variable-length-bar, by extending the "Child_2".
I'll try using UITable, anyway!