Skip to content

Commit

Permalink
Merge pull request #1348 from anatawa12/fix-nre-prefab
Browse files Browse the repository at this point in the history
fix: NRE on save prefab from PrefabStage
  • Loading branch information
anatawa12 authored Nov 17, 2024
2 parents fd12add + 1d96f8d commit 46fe030
Show file tree
Hide file tree
Showing 3 changed files with 5 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
- NRE when saving Prefab with PrefabSafeUniqueCollection `#1348`

### Security

Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ The format is based on [Keep a Changelog].
- Reimplement Preview system with NDMF Preview System `#1131` `#1195` `#1218` `#1270`
- This will prevent issues relates to Animation Mode bug.
- This allows you to preview Remove Mesh components without selecting Mesh OR while in Animation Mode.
- Improved Prefab Safe Set, which are used in MergePhysBone, MergeSkinnedMesh, FreezeBlendShape and more components `#1212` `#1219` `#1221` `#1236` `#1287` `#1294`
- Improved Prefab Safe Set, which are used in MergePhysBone, MergeSkinnedMesh, FreezeBlendShape and more components `#1212` `#1219` `#1221` `#1236` `#1287` `#1294` `#1348`
- This should improve compatibility with replacing base prefab, which is added in Unity 2022.
- Allow multiple component for Remove Mesh components with API `#1216` `#1218`
- This allows non-destructive tools to add Remove Mesh components even if Remove Mesh component are added before.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ public static void OnValidate<TComponent>(TComponent component,
// - OnValidate will be called for prefab instance when the base prefab is changed
var PrefabSafeUniqueCollection = getPrefabSafeUniqueCollection(component);

// The prefab from prefab stage is going to be saved. I don't update on this phase.
if (component == null) return;

// detect creating new prefab
var newCorrespondingObject = PrefabUtility.GetCorrespondingObjectFromSource(component);
if (newCorrespondingObject != null &&
Expand Down

0 comments on commit 46fe030

Please sign in to comment.