Skip to content

Commit 137705e

Browse files
second setDirty only when component data succesfully updated
1 parent 15f7dea commit 137705e

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

Editor/Tools/UpdateComponentTool.cs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -125,15 +125,16 @@ public override JObject Execute(JObject parameters)
125125
return McpUnitySocketHandler.CreateErrorResponse(errorMessage, "update_error");
126126
}
127127
}
128+
129+
// Ensure field changes are saved
130+
EditorUtility.SetDirty(gameObject);
131+
if (PrefabUtility.IsPartOfAnyPrefab(gameObject))
132+
{
133+
PrefabUtility.RecordPrefabInstancePropertyModifications(component);
134+
}
135+
128136
}
129-
130-
// Ensure changes are saved
131-
EditorUtility.SetDirty(gameObject);
132-
if (PrefabUtility.IsPartOfAnyPrefab(gameObject))
133-
{
134-
PrefabUtility.RecordPrefabInstancePropertyModifications(component);
135-
}
136-
137+
137138
// Create the response
138139
return new JObject
139140
{

0 commit comments

Comments
 (0)