I have these classes:
public class MyClass : MonoBehaviour{
[SerializeField]
MonoBehaviour myOtherMonoBehaviour;
}
public class MyOtherClass : MonoBehaviour{
[SerializeField]
float value;
}
I would now like to write a custom inspector for MyClass which checks if myOtherMonoBehaviour is of type MyOtherClass and if so, show its field value
in the inspector of MyClass.
How do I write the check for the Type and displaying value
in the custom editor ?
I know EditorGUILayout.PropertyField
for displaying a property field for a serialized object, but how do I target value
, if myOtherMonoBehaviour is of type MyOtherClass ?