I need to dump selected GameObjects to a file, with all their components and their components variable names and values.
Is there a generic 'getAttribute' kind of API I can call if I have a Component and I don't know the type?
asked Jul 26 '10 at 07:43 PM
You could always abuse reflection and generics for it.
This has the benefit of working on any object, not just components. Use GetValue when you know it'll be a value type, GetReference when it'll be a reference type. Added SetField just for fun too (which works without generics for obvious reasons)
Hopefully pretty self explanatory
answered Jul 26 '10 at 08:01 PM
This should get me started: