Custom inspector values in prefab mode not save to prefab
I have a prefab with a custom GridModel
component which has a custom editor. For some reason whenever I edit a value in Prefab Mode, the value doesn't save in the prefab asset and vice versa. How can I fix this issue?
Here is my code:
public class GridModel : MonoBehaviour, IGridModel
{
public Vector2Int dimensions;
}
[CustomEditor(typeof(GridModel))]
public class GridModelEditor : Editor
{
private GridModel gridModel;
void OnEnable()
{
gridModel = (GridModel)target;
}
public override void OnInspectorGUI()
{
gridModel.dimensions = EditorGUILayout.Vector2IntField("Size", gridModel.dimensions);
}
}