- Home /
Problem with showing "infinite saves" menu
I have this code that is supposed to show infinite save list:
private void loadgamewindow(float x, float y, float w, float h){
GUI.Box(new Rect(x,y,w,h),"Load Game");
if (GUI.Button(new Rect(x+w-22,y+2,20,20),"x")){
windowState = 0;
}
loadscroll = GUI.BeginScrollView(new Rect(x,y+24,w,h-24),loadscroll,new Rect(0,0,w-2,24*savefilenames.Length));
for (int i=0;i<mosaicnamesArr.Length;i++){
if (GUI.Button(new Rect(0,24*i,w-2,24),mosaicnamesArr[i])){
}
}
GUI.EndScrollView();
}
It is executed in OnGUI, but it hangs game when load menu is accessed. I suspect it is fault of for loop, but how can I show infinite save list otherwise?
I don't see anything wrong with that, but you are using two different arrays (mosaicnamesArr and savefilenames). Hard to tell if that's intentional.
What does the calling code look like?
Your capitalization is very messy and will cause you confusion. :)
Two arrays are here because one stores save filenames and other (mosaicnamesArr) stores actual world names. But quick session with debugger has shown me that I have bigger problems to worry about (NREs and some other fun stuff) so that question may not be valid.
Your answer
Follow this Question
Related Questions
Unity 3d C# saving and Loading Values 2 Answers
Getting item from List without a loop 1 Answer
Problem when saving and loading 1 Answer
Dynamically saving and loading player-created prefabs 0 Answers
Multiple Cars not working 1 Answer