Singularity/Library/PackageCache/com.unity.2d.spriteshape@7.0.7/Editor/SpriteShapeAssetPostProcess...
2024-05-06 11:45:45 -07:00

26 lines
841 B
C#

using UnityEngine;
using UnityEngine.U2D;
using UnityEditor;
namespace UnityEditor.U2D
{
public class SpriteShapeAssetPostProcessor : AssetPostprocessor
{
static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths)
{
if (importedAssets.Length > 0)
{
GameObject[] allGOs = UnityEngine.Object.FindObjectsOfType<GameObject>();
foreach (GameObject go in allGOs)
{
if (!go.activeInHierarchy)
continue;
SpriteShapeController sc = go.GetComponent<SpriteShapeController>();
if (sc != null)
sc.RefreshSpriteShape();
}
}
}
}
}