Disable In Editor Mode Attribute

DisableInEditorMode is used on any property, and disables the property when not in play mode. Use this when you only want a property to be editable when in play mode.

[Title("Disabled in edit mode")]
[DisableInEditorMode]
public GameObject A;

[DisableInEditorMode]
public Material B;