wuxianshengcong/Library/PackageCache/com.unity.2d.psdimporter@8.0.5/Editor/PSDImportPostProcessor.cs

32 lines
1.0 KiB
C#
Raw Permalink Normal View History

2025-01-02 14:49:00 +08:00
using UnityEngine;
namespace UnityEditor.U2D.PSD
{
internal class PSDImportPostProcessor : AssetPostprocessor
{
private static string s_CurrentApplyAssetPath = null;
public static string currentApplyAssetPath
{
set { s_CurrentApplyAssetPath = value; }
}
static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromPath)
{
if (!string.IsNullOrEmpty(s_CurrentApplyAssetPath))
{
foreach (var asset in importedAssets)
{
if (asset == s_CurrentApplyAssetPath)
{
var obj = AssetDatabase.LoadMainAssetAtPath(asset);
Selection.activeObject = obj;
Unsupported.SceneTrackerFlushDirty();
s_CurrentApplyAssetPath = null;
break;
}
}
}
}
}
}