Skip to content

Commit

Permalink
Merge pull request #1372 from anatawa12/prefab-on-launch-unity
Browse files Browse the repository at this point in the history
fix: prefab overrides are reverted on first load of the scene at first launch
  • Loading branch information
anatawa12 authored Dec 22, 2024
2 parents 8897af7 + 5bbe3f4 commit 5297c6e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG-PRERELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ The format is based on [Keep a Changelog].
### Removed

### Fixed
- Prefab overrides on the scene are reverted on first load of the scene at first launch `#1372`

### Security

Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ The format is based on [Keep a Changelog].
### Removed

### Fixed
- Prefab overrides on the scene are reverted on first load of the scene at first launch `#1372`

### Security

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ public static void OnValidate<TComponent>(TComponent component,
var newCorrespondingObject = PrefabUtility.GetCorrespondingObjectFromSource(component);
if (newCorrespondingObject != null &&
PrefabUtility.GetCorrespondingObjectFromSource(newCorrespondingObject) ==
PrefabSafeUniqueCollection.CorrespondingObject)
PrefabSafeUniqueCollection.CorrespondingObject
&& !PrefabSafeUniqueCollection.IsNew) // not loading scene
{
// this might be creating prefab. we do more checks
var newCorrespondingPrefabSafeUniqueCollection = getPrefabSafeUniqueCollection(newCorrespondingObject);
Expand Down

0 comments on commit 5297c6e

Please sign in to comment.