Good ways of storing complex data


I have UI which is riddled with buttons. There are so many buttons that it’s hard in script to locate the right one. So the question is how to store button information so I can access it easily?

In depth explanation : I need to store button information like his original position and other attributes that belongs to that particular button. I was looking at struct indexers, but the flaw I see using indexers is that it will need different indexer for different button.

How I imagine it : I don’t know if this method of “overloading” or “concatenating” exists but I am looking for something like this:
float originalsButtonPos = allUiButtons.ParticularButton.ButtonsOriginalPosition

allUibuttons - contains all ui buttons (button can be expressed as just a string of name not a game object itself).

Particularbutton - Particular button name that contains associated data.

ButtonOriginalPosition - One of many attributes of that particular button(there can be color, size and so on).

If you know more information about this data collecting method I wold be really grateful if you shared it with me :slight_smile: .You can just drop me a link or one sentence like “look for static classes and inside of them use struct for each button” and I will find the rest.

You can make your own types. Here’s the link to a Unity tutorial: Lists and Dictionaries - Unity Learn

Hope this helps @TrashestCoder! :slight_smile: