Chasing a a Bug, More More UI


This one was particularly bad and I spent the best part of an evening trying to find and fix it, and as usual the error was because of some stupid assignment of variables that I must have wrote whilst half asleep or something. What happened was for some stupid reason I had the scripts activate the pointer in the array index equal to the number of pointer out rather than the first empty pointer slot in the array, meaning the whole thing broke if you added and removed pointers out of order. And the whole thing was dealt with by replacing the index numbers with the for loop variable used for finding the empty array space which I had already done at the start. Blegh.



Other than that, I've actually got a simple thing set up so that the levels can actually switch between each other, as well as a cheeky fade in effect to hide anything that could potentially be loading. Something that I discovered was that you have to enable a scene in File >> Build Settings... (Ctrl-Shift-B) in order to switch to them using code, otherwise you get the error telling you to enable it in the build settings. Unity is great for that kind of thing. It also seems to dictate load order, so I have a dummy scene set up at the top of the build list that initialises the static global variables (like the level the player is on) then redirects to the first actual scene. I'm not sure if this is the right way to do it but it works for me (cue crash to desktop/home screen).

All boring back end stuff, like trying to find out how to get on-scene GUITexture buttons to work, how to keep track of levels and how to make scene changes in code.

All in all, it's starting to come together. Sort of.

No comments:

Post a Comment