I'm trying to set a property of an object in a class, but I can't get the property.
FieldInfo dControl = window.GetType().GetField("dControl", BindingFlags.NonPublic | BindingFlags.Instance);
if (dControl == null) { Debug.Log ("dControl is null"); return;}
PropertyInfo inPreviewMode = dControl.GetType().GetProperty("InPreviewMode", BindingFlags.Public | BindingFlags.Instance);
if (inPreviewMode == null) { Debug.Log ("dControl.InPreviewMode is null"); return;}
inPreviewMode.SetValue(dControl, false, null);
inPreviewMode returns null, however.
This is the property I'm trying to access:
public class DControl : TimeArea
{
public bool InPreviewMode
{
get
{
return dState.IsInPreviewMode;
}
...
}
...
}
The class is stored as a dll if that matters.
Help is appreciated.
Aucun commentaire:
Enregistrer un commentaire