Using FieldInfo.GetValue with GameObject field doesn't work.
---
Code always gives null result:
public GameObject someVar;
...
GameObject go = fieldInfo.GetValue(parentScript) as GameObject;
---
While the same with any Component works fine:
public Transform someVar;
...
Transform tr = fieldInfo.GetValue(parentScript) as Transform;
---
Why could it be? Is it possible to get GameObject variable through reflection?
Thanks
↧