Hi,
I’ve been thinking about how i’m going to build my script and writing a bunch of tests to see if i can get it to work.
I’m utilizing EZGUI and iTween but that’s the part i have already sorted out so don’t worry about that.
Basically I’m building a multi level menu. Each level has several buttons that refer an object on stage. You can consider a button just a regular GameObject.
Each button calls a focusObject(object Transform, range int); (Excuse the pseudo code), which makes the camera go to a certain object. Pressing a button not only focuses on an object, it also makes the menu go 1 level deeper.
Each set of buttons belongs to a Panel, you can consider this an empty GameObject called “Panel x”.
I’m trying to build this script in such a way that i can just add as many panels, buttons and objects as i want. I learned about Serializing today and was thinking about applying that with several arrays to manage all the data properly.
Hope this describes what i want to do clearly!
Now, what i came up with:
Panel Manager(empty GameObject)
|_ Panel 1 (EZ GUI GameObject)
|_ Button 1 (EZ GUI GameObject)
|_ Button 2 (EZ GUI GameObject)
|_ Panel 2 (EZ GUI GameObject)
|_ Button 3 (EZ GUI GameObject)
|_ Button 4 (EZ GUI GameObject)
|_ Button 5 (EZ GUI GameObject)
|_ Panel 3 (EZ GUI GameObject)
|_ Button 6 (EZ GUI GameObject)
|_ Button 7 (EZ GUI GameObject)
|_ … ad nauseum[/list:u:c7a178cca7]
each button refers to an object for positioning.
Now i recon i should make a dataClass with Serialization (i love them drop down menus) and make an instance of it.
Fill the data class with all the panels, so i can show the right panel at each menu depth.
Fill each panel with the buttons that i want and set them up in the data class.
Fill the objects array with each button at the same index that the button class is.
Now where i need a little help is: how can I properly link the button index to the object index
and is it possible to create a variable on an object?
I’m used to flash where i can just say movieClip.madeUpVariable and I’d like to be able to do this in unity so i can pass a range variable to the focusObject function.
If anyone has any suggestions or pseudo code on how to get this up and running in a way that allows me to easily extend it or add as many objects as i want without hard coding more then is required, that’d be great!
Sorry for the wall of text!