Author Topic: problem in hierarchy  (Read 2621 times)

johanesnw

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 22
    • View Profile
problem in hierarchy
« 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

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.

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)

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: problem in hierarchy
« Reply #1 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.

johanesnw

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 22
    • View Profile
Re: problem in hierarchy
« Reply #2 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