Author Topic: Spawn UIScroll View  (Read 5403 times)

zeeawk

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 7
    • View Profile
Spawn UIScroll View
« on: June 16, 2014, 04:12:13 AM »
I'm trying to spawn a UIScroll View next to one of my game objects. Kind of like a popup menu that would appear when the object is clicked.
I created a prefab for it but am having a hard time getting it to display properly. Can anyone point me to some code that can help?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Spawn UIScroll View
« Reply #1 on: June 16, 2014, 08:36:58 AM »
NGUITools.AddChild(parent, prefab);

zeeawk

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 7
    • View Profile
Re: Spawn UIScroll View
« Reply #2 on: June 16, 2014, 09:49:23 AM »
I just tried that but it spawns it extremely large. How can I spawn it the correct size and position it?

zeeawk

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 7
    • View Profile
Re: Spawn UIScroll View
« Reply #3 on: June 17, 2014, 12:54:20 AM »
NGUITools.AddChild(parent, prefab);

Should the parent be my object on screen I want it to spawn next to or does the parent need to be in the UI Root?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Spawn UIScroll View
« Reply #4 on: June 17, 2014, 01:31:21 PM »
Parent object must be some object in your UI hierarchy.