Skip to content

Commit 793cdb6

Browse files
fix
Fixing an exception that can occur when you have a network prefab opened for editing and then you delete the prefab asset before exiting the prefab edit mode.
1 parent 9dd32d5 commit 793cdb6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

com.unity.netcode.gameobjects/Runtime/Core/NetworkObject.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ private static void CheckPrefabStage(PrefabStage prefabStage)
218218
s_PrefabAsset = AssetDatabase.LoadAssetAtPath<NetworkObject>(s_PrefabStage.assetPath);
219219
}
220220

221-
if (s_PrefabInstance.GlobalObjectIdHash != s_PrefabAsset.GlobalObjectIdHash)
221+
if (s_PrefabAsset && s_PrefabInstance && s_PrefabInstance.GlobalObjectIdHash != s_PrefabAsset.GlobalObjectIdHash)
222222
{
223223
s_PrefabInstance.GlobalObjectIdHash = s_PrefabAsset.GlobalObjectIdHash;
224224
// For InContext mode, we don't want to record these modifications (the in-scene GlobalObjectIdHash is serialized with the scene).

0 commit comments

Comments
 (0)