Is there a way to enumerate fields (name/value) on any Component?

I'm trying to use Reflection to dump a scene graph.

I found a way to get all components on a GameObject. If those components happen to be Scripts, I can easily find the name/type/value for each field. Great.

Problem is, when it hits normal Unity components, I don't get any fields enumerated. Eg, Transform, MeshRenderer, MeshCollider, etc. (Using "foreach( FieldInfo fi in c.GetType().GetFields() )" where c is the Component)

Is there an API, either in Unity or System (or other?) which will get list all the fields on a Unity Component?

They're not fields, they're properties (Methods masquerading as fields). Grab the PropertyInfos instead of FieldInfos and you should see them

In cases like this I always revert back to GetMembers() so I can see everything in a given object. I believe what you are wanting in this case is actually GetProperties(), which GameObject has in plenty.

`
MeshRenderer c = ex.GetComponent(typeof(MeshRenderer)) as MeshRenderer;

// To see all the members of an object.
foreach( MemberInfo fi in c.GetType().GetMembers() )
  Debug.Log(string.Format("{0} = {1}", fi.Name, fi.MemberType));

// To see just the properties of an object.
// Note GetValue in this case has 2 args, the second 
// applies to Properties that are Indexers.
foreach( PropertyInfo fi in c.GetType().GetProperties() )
  Debug.Log(string.Format("{0} = {1}", fi.Name, fi.GetValue(c, null)));
`