Files
ichni_Official/Packages/io.continis.subassets/Editor/SubAssetsToolbox.cs
2026-07-05 16:08:23 -04:00

25 lines
850 B
C#

using SubAssetsToolbox.Editor.SubAssetAware;
using UnityEditor;
using UnityEngine;
namespace SubAssetsToolbox.Editor
{
static class SubAssetsToolbox
{
public static void AddSubAsset(string destinationPath, Object objectToClone, out Object newClone)
{
newClone = Object.Instantiate(objectToClone);
newClone.name = objectToClone.name;
AssetDatabase.AddObjectToAsset(newClone, destinationPath);
SubAssetAwareMethods.NotifyAwareObjectOfAddition(destinationPath, newClone);
}
public static void RemoveSubAsset(string oldParentPath, Object objectToRemove)
{
SubAssetAwareMethods.NotifyAwareObjectOfRemoval(oldParentPath, objectToRemove);
AssetDatabase.RemoveObjectFromAsset(objectToRemove);
}
}
}