Skip to content

Commit efbc732

Browse files
committed
Merge branch '12-remove-odin-dependency'
2 parents 29a90c3 + 45cac7c commit efbc732

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

Editor/SOVariant.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ public void LoadData(T targetObject)
231231
_SOVariantProperlyLoaded = false;
232232
return (null, null, null, null);;
233233
case (2):
234-
return ExtractData(ReadUpdatedMetaFile(data));
234+
return ExtractData(ReadUpdatedMetaFile(data, AssetDatabase.GetAssetPath(_target), _import));
235235
}
236236
}
237237
return (null, null, null, null);
@@ -436,7 +436,7 @@ private void WriteToImporter(AssetImporter importer, string parent, string overr
436436
{"childrenGUIDs", children}
437437
});
438438

439-
if (CheckForUserDataAndOverride(_import, _import.userData, data))
439+
if (CheckForUserDataAndOverride(importer, importer.userData, data))
440440
importer.userData = JsonConvert.SerializeObject(new Dictionary<string, string>()
441441
{{"SOVariantData", data}});
442442
}
@@ -464,7 +464,7 @@ private bool CheckForUserDataAndOverride(AssetImporter importer, string oldData,
464464
{
465465
switch (EditorUtility.DisplayDialogComplex(
466466
"Replace user data",
467-
$"While trying to save the SOVariant object \"{_target}\", a previous UserData entry " +
467+
$"While trying to save the SOVariant object \"{importer.assetPath}\", a previous UserData entry " +
468468
$"was found which can not be loaded into a Json file: \"{importer.userData}\", conflicting with " +
469469
$"saving the data at hand.\nWould you like to override it? " +
470470
$"(Aborting will prevent the modified SOVariant data to be saved)\n\n" +
@@ -479,7 +479,7 @@ private bool CheckForUserDataAndOverride(AssetImporter importer, string oldData,
479479
Debug.Log($"UserData in File \"{importer.assetPath}.meta\" not overwritten.");
480480
return false;
481481
case (2):
482-
string newOldData = ReadUpdatedMetaFile(oldData);
482+
string newOldData = ReadUpdatedMetaFile(oldData, importer.assetPath, importer);
483483
return CheckForUserDataAndOverride(importer, newOldData, newData);
484484
}
485485
}
@@ -488,9 +488,9 @@ private bool CheckForUserDataAndOverride(AssetImporter importer, string oldData,
488488
return true;
489489
}
490490

491-
private string ReadUpdatedMetaFile(string oldData)
491+
private string ReadUpdatedMetaFile(string oldData, string targetPath, AssetImporter importer)
492492
{
493-
string[] lines = System.IO.File.ReadAllLines(AssetDatabase.GetAssetPath(_target) + ".meta");
493+
string[] lines = System.IO.File.ReadAllLines(targetPath + ".meta");
494494
foreach (string line in lines)
495495
{
496496
if (line.StartsWith(" userData: "))

0 commit comments

Comments
 (0)