Skip to content

Commit

Permalink
fix: CS0618 warning when access PrefabStage.assetPath
Browse files Browse the repository at this point in the history
  • Loading branch information
favoyang committed May 15, 2021
1 parent 94170b8 commit 9682904
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions Editor/AddressableImporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,22 @@ static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAsse

// Apply import rules.
var prefabStage = PrefabStageUtility.GetCurrentPrefabStage();
#if UNITY_2020_1_OR_NEWER
string prefabAssetPath = prefabStage.assetPath;
#else
string prefabAssetPath = prefabStage.prefabAssetPath;
#endif
foreach (var importedAsset in importedAssets)
{
if (prefabStage == null || prefabStage.prefabAssetPath != importedAsset) // Ignore current editing prefab asset.
if (prefabStage == null || prefabAssetPath != importedAsset) // Ignore current editing prefab asset.
dirty |= ApplyImportRule(importedAsset, null, settings, importSettings);
}

for (var i = 0; i < movedAssets.Length; i++)
{
var movedAsset = movedAssets[i];
var movedFromAssetPath = movedFromAssetPaths[i];
if (prefabStage == null || prefabStage.prefabAssetPath != movedAsset) // Ignore current editing prefab asset.
if (prefabStage == null || prefabAssetPath != movedAsset) // Ignore current editing prefab asset.
dirty |= ApplyImportRule(movedAsset, movedFromAssetPath, settings, importSettings);
}

Expand Down

0 comments on commit 9682904

Please sign in to comment.