Is it possible (through reflection?) To sort through all the fields of the object that calls the method on each of them.
I have a class like:
public class Overlay { public Control control1; public Control control2; }
I need a method that looks something like this:
public void DrawAll() { Controls[] controls = "All instances of Control" foreach (Control control in Controls) { control.Draw() } }
Can this be done? I managed to get all the metadata in the Control class, but this only applies to the type and not to the specific instance.
I know this seems strange, but I have reasons. I use Unity 3D, and each control is actually a GUI control created by an editor.
Thanks for any help.
source share