|
I am using reflection in an editor script. The script looks up all of the components on a GameObject and returns their properties with GetProperties(); Some properties are obsolete and return an error when used in conjunction with GetValue such as: How can we check for these obsolete properties or simply avoid having to see these error messages? Edit: The problematic properties I've found were "rolloffFactor","minVolume", and "maxVolume" which are all from AudioSource. My current workaround is to check for these property names and skip them.
(comments are locked)
|
|
You need to use:
(comments are locked)
|
|
I accidently just posted some code first, but the idea is to look for an Obsolete attribute on your property. Here's some more info: http://msdn.microsoft.com/en-us/library/system.reflection.propertyinfo.getcustomattributes.aspx And a code snippet: You are better off using IsDefined though - there's no array allocated so it removes the chance of extra GC ;)
Jun 25 '12 at 12:53 PM
whydoidoit
Ah, good to know, thanks :)
Jun 25 '12 at 01:04 PM
Synthesizer
(comments are locked)
|
