Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: johanesnw on February 02, 2014, 03:26:29 AM

Title: problem in hierarchy
Post by: johanesnw on February 02, 2014, 03:26:29 AM
hi, I'm new to NGUI. I've just bought NGUI 8hours ago (and 1month exp in unity  :P)
I want to make UI for weapon shop. It's a vertical scrollview on left side, and the weapon preview on right side.
So, for practice I want to clone example7 but make it vertical.
It goes well when I use bunch of sprites only. then I want to group them in an object.

But I got trouble here... its example7's hierarchy
(http://i1260.photobucket.com/albums/ii566/ind0dark/Capture_zps49216754.png) (http://s1260.photobucket.com/user/ind0dark/media/Capture_zps49216754.png.html)
the "item0"... that's just an empty "trigger" GameObject right? or not?

I tried to create GameObject (isTrigger), and highlight it. then from NGUI > create > anything (sprite/tex/label) it won't fit the gameObject I created.
Its like the created sprite fills the entire world, almost 10x panel size (even it's just a 32x32).
below is a screenshot. The white box is a scrollview thats filled with a GIANT sprite that I create inside GameObject.
(http://i1260.photobucket.com/albums/ii566/ind0dark/Capture_zps18960282.png) (http://s1260.photobucket.com/user/ind0dark/media/Capture_zps18960282.png.html)
and you could see the little Xbox "A" sprite in game window. That I create outside gameObject (highlighting nothing, then NGUI>Create), and then drag it to gameObject.

It's been 4 hours since I got this trouble and looking for solutions. but maybe i'll just ask here  :-\

and like I said I just know NGUI last night. so don't be so rude X)
Title: Re: problem in hierarchy
Post by: Nicki on February 02, 2014, 12:06:14 PM
Are you creating the sprite inside the hierarchy? Check your inspector what the size of the sprite actually is - likely you've created them at the root level (outside the UIRoot) which means 32x32 is gigantic, because UIRoot scales all its children by 1/screen.height to achieve the virtual pixels that you use in localPosition.

So, check the localScale in the inspector - everything should be 1,1,1 all the way up to the UIRoot which will be some tiny number.
Title: Re: problem in hierarchy
Post by: johanesnw on February 03, 2014, 01:27:44 AM
aha... got it now. If I create an empty game object it will always be a root. then I drag that empty object to UI Root, and didn't notice that the scale is 360x360x360.
just clicking the "S" solves everything. thanks Nicki  ;D
I'm glad this error occurs in my 1st day. so that I won't get into this later  :P