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); } } }