|
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?
(comments are locked)
|
|
You could always abuse reflection and generics for it. Something like:
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 Thanks Mike. Had dug up an answer myself, posted before I saw your answer, but you've given me some good stuff to work with there.
Jul 26 '10 at 08:05 PM
DaveA
Hehe, nice work on finding it so fast
Jul 26 '10 at 08:10 PM
Mike 3
(comments are locked)
|
|
This should get me started: sorry for bad formatting
Jul 26 '10 at 08:09 PM
DaveA
for the code blocks, just paste the code in, select all, then click the code button (button with 0s and 1s) - works a heck of a lot better than either pre or code tags
Jul 26 '10 at 08:16 PM
Mike 3
(comments are locked)
|
