Files
Cielonos/Packages/io.continis.subassets/Editor/SubAssetsToolbox.cs
SoulliesOfficial f26f9fd374 爆更
2026-03-20 12:07:44 -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);
}
}
}