so yeah, wanted to make a scrollarea and noticed that GUI.BeginScrollView doesn´t work on iPhone (just doesn´t show anything where the scroll area should be).
Is there a way to mask gui stuff to only be visible in a certain area? (so one could work on something like a scroll area oneself)
BeginGroup works for that.
thanks man, good stuff. using that and some hacking i was able to do a scrollfield pretty quickly, works nicely
now on to make it scroll in fancy easing manner like the scrollers usually do on the iPhone
Hm, big bummer:
so the BeginGroup gui stuff works fine for masking by itself but i just noticed that when i have twice as many gui elements in it (although only the same amount is visible in the viewable mask area)
it also almost doubles the drawcalls count
which seems very weird to me, i mean shouldn´t it only draw the elements that are in the viewable area right now and therefore pretty much always need the same amount of drawcalls?
Quite a sad performance downer now.
Can someone from UT give feedback on this? I mean is it a bug, will it be changed or is it to be expected behaviour?
well, i got around the draw calls problem quickly by doing this now:
if(targetPos>-buttonHeight targetPos+buttonHeight<scrollAreaOffsetY+scrollAreaHeight){
So basically i check if the y position of a element in my list is within the area of the GUI Group so then i draw it and otherwise not, so now i have a pretty constant draw call count no matter how many list items i have.
I still wonder though why the GUI drawing side of unity doesn´t handle that automatically ( i mean not trigger draw calls for gui elements which are outside the screen or outside the area of a GUI group they should be in).
So yeah, would be cool if UT fellas can look into this, for my paricular case i got around it now
I haven’t had any trouble with GUI.BeginScrollView in my iPhone apps (the only caveat is that it doesn’t “flick” scroll like some other iPhone interfaces). Maybe you could post your code?
I sadly don´t have my code for the GUI.ScrollView version anymore (since i already changed it) but from what i remember it also doesn´t show the scrollview example on the iphone that is in the unity docs.
I also won´t spend any more time in looking into that now since meanwhile i´ve coded my own scrollview that supports flicking based control on the whole scrollarea etc so that´s more useful for iphone usage anyway.
I think the problem is that ScrollView is like Window, it doesn’t work if you set useGUILayout=false because it uses GUILayout internally.
Hmm… I haven’t set useGUILayout=false anywhere, but it works for me.
jeff: i see, and yeah (also to mklaurence) : explains why it didn´t work for me, i use useGUILayout=false for all gui stuff on the iPhone to save performance.
will cost you a not so nice amount of performance
Yeah, definitely wouldn’t want to use it during gameplay, but it’s working speedily enough in my menus when the game is paused.
That naturally is true