- Home /
Scrollable Content Window? Unity iPhone
Hi all,
This might seem like a very basic question but it's something i've not needed to know until now...
A game i'm working on requires the user make a song selection from within the game (not a song from the iPod or anything, but a song from my own predefined list)... The number of songs to select from far-exceeds what can fit on one screen, so the user needs to be able to scroll down the list to make their selection. It might be nice if the scrollable area sat underneith the top-bar of the app so that scrolling doesn't push the top-bar off the screen.
I was wondering if there's anything built in for this purpose or if anyone had any suggestions for the best way to go about doing this? I'm using SpriteManager for all of my on-screen elements for performance (keeping down draw calls) and i'm avoiding OnGUI features which i'm told racks up draw calls.
My initial thought was that i'd have to physically move the camera to give the effect of scrolling and parent the background image to the camera so that it doesn't appear to scroll... however I figured there's probably a less cumbersome way to do this simple thing.
Any advice greatly appreciated as always.
Thanks
Mat
Answer by StephanK · Apr 27, 2010 at 09:43 AM
As you won't display this menu all the time in your game I don't see why you couldn't use OnGUI(). There is GUI.ScrollView to deal with your problem... ;)
I guess 1 added draw call wouldn't hurt, but would I not need to use other GUI elements to make up the song selection elements? Or, is there a way I could use Sprite$$anonymous$$anager in conjunction with GUI.ScrollView?
Thanks very much for your help
Never used Sprite$$anonymous$$anager, so don't know the answer to that question.
However, the point was, that when showing a menu fps isn't that important, so that keeping drawcalls down maybe isn't necessary.
Answer by Groov · Jul 16, 2010 at 02:41 AM
I guess i have something similar for my app's main menu system, where there are 13 selections available, with the screen only showing 3 of these at a time.
I place each of the 13 selections as GOs and use spritemanager2 to assign the texture from the atlas material.
I then use a touch controlled scroller script to control the main camera up and down the list. To the right of my list is an info bar that is a GUITexture. This also acts nicely as a frame (you could have it on top too if you want and the GOs would scroll under it).
(note that the above 13 items are NOT children of the main camera, but are placed in the scene one under the other).
I find this method very easy to set up and not costly on the draw cells too.
Hope this helps
Your answer
Follow this Question
Related Questions
A node in a childnode? 1 Answer
How to support Retina display 1 Answer
How do I invert the Y axis in Penelope tutorial? 3 Answers
Compiling in Xcode? 0 Answers
Spawn Script not working on iPhone? 0 Answers