Skip to content

Commit e71da54

Browse files
Improve errors with context
1 parent e38e257 commit e71da54

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

Assets/CrossSceneReference/GuidManager.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,13 +117,13 @@ private bool InternalAdd(GuidComponent guidComponent)
117117
// normally, a duplicate GUID is a big problem, means you won't necessarily be referencing what you expect
118118
if (Application.isPlaying)
119119
{
120-
Debug.AssertFormat(false, "Guid Collision Detected between {0} and {1}.", (guidToObjectMap[guid].go != null ? guidToObjectMap[guid].go.name : "NULL"), (guidComponent != null ? guidComponent.name : "NULL"));
120+
Debug.AssertFormat(false, guidComponent, "Guid Collision Detected between {0} and {1}.\nAssigning new Guid. Consider tracking runtime instances using a direct reference or other method.", (guidToObjectMap[guid].go != null ? guidToObjectMap[guid].go.name : "NULL"), (guidComponent != null ? guidComponent.name : "NULL"));
121121
}
122122
else
123123
{
124124
// however, at editor time, copying an object with a GUID will duplicate the GUID resulting in a collision and repair.
125125
// we warn about this just for pedantry reasons, and so you can detect if you are unexpectedly copying these components
126-
Debug.LogWarningFormat("Guid Collision Detected while creating {0}.\nAssigning new Guid.", (guidComponent != null ? guidComponent.name : "NULL"));
126+
Debug.LogWarningFormat(guidComponent, "Guid Collision Detected while creating {0}.\nAssigning new Guid.", (guidComponent != null ? guidComponent.name : "NULL"));
127127
}
128128
return false;
129129
}

Assets/CrossSceneReference/SampleContent/LoadScenes.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ void Update ()
2020
foreach( var info in scenes )
2121
{
2222
Scene scene = SceneManager.GetSceneByName(info.name);
23+
2324
if (info.shouldLoad && !scene.isLoaded)
2425
{
2526
SceneManager.LoadScene(info.name, LoadSceneMode.Additive);

0 commit comments

Comments
 (0)