Cause and mechanism
A Prefab is an asset that stores a reusable GameObject setup. Editing the source Prefab differs from making an override on one instance in a scene. If an Editor tool's changes disappear, check whether it edits the source asset or a scene instance and which of those it saves.
Check and correct the setup
- Load prefab contents, edit, save, and unload in finally; supported Unity versions also offer EditPrefabContentsScope.
Follow input, processing / condition, then output - For instances, use serialized properties or the appropriate undo/override-recording APIs, then save the scene.
Follow input, processing / condition, then output - Apply writes overrides back to an asset. Check the intended property and nested/variant target.
Follow input, processing / condition, then output
Limits and verification
Keep Editor APIs in Editor assemblies. Reopen the prefab and verify saved values and intended overrides.
A focused diagnostic setup
Use a test prefab and change one value, treating the Project asset and scene instance as separate save destinations.
Test in this order
- For asset editing, operate on the loaded prefab root, save successfully and unload contents in finally.
Follow input, processing / condition, then output - For instances, inspect Undo/serialized modifications, overrides and scene dirty/save state.
Follow input, processing / condition, then output - Close and reopen the prefab and reload the scene, verifying both the intended value and unrelated overrides.
Follow input, processing / condition, then output
Interpret the result
A temporary Inspector change does not establish persistence. With variants/nesting, confirm the apply destination rather than applying every override and losing other edits.