I'm trying to work on a system for my Unity3D game that easily allows me to show properties by just passing them into a function. But in order to make it work, I need the property name and I can't properly get it. Right now, this is what I've made.
In my "inspector script" I basically just to this. This will call an inherited function that should handle the "other" stuff. In this case, 'value' is Unity's Transform component and 'position' is a Vector3 property.
DoUI(value.position);
The "DoUI" function
protected virtual void DoUI(object property)
{
Type type = property.GetType();
Debug.Log("Type ToString: " + type.ToString() + " | Name: " + type.Name + " | Full Name: " + type.FullName);
}
Right now, the function only prints a debug message and by looking at that, I can see that it's not correct. It gives me the type name, in this case, Vector3, and yes, I know that you can clearly see that by looking at the code.
So the question remains, how can I get a property name by just passing it "as is" without the user having to do any complicated reflection calls? That's what "DoUI" is for.