Add AacFlBase.DuplicateAsset
This commit is contained in:
@@ -3,6 +3,7 @@ using System.Reflection;
|
||||
using UnityEditor;
|
||||
using UnityEditor.Animations;
|
||||
using UnityEngine;
|
||||
using Object = UnityEngine.Object;
|
||||
using Random = UnityEngine.Random;
|
||||
|
||||
// ReSharper disable once CheckNamespace
|
||||
@@ -41,6 +42,15 @@ namespace AnimatorAsCode.V1
|
||||
return clip;
|
||||
}
|
||||
|
||||
internal static T DuplicateAssetIntoContainer<T>(AacConfiguration component, T assetToDuplicate) where T : Object
|
||||
{
|
||||
var duplicated = (T)Object.Instantiate(assetToDuplicate);
|
||||
duplicated.name = "zAutogenerated__" + component.AssetKey + "__" + assetToDuplicate.name + "_" + Random.Range(0, Int32.MaxValue); // FIXME animation name conflict
|
||||
duplicated.hideFlags = HideFlags.None;
|
||||
AssetDatabase.AddObjectToAsset(duplicated, component.AssetContainer);
|
||||
return duplicated;
|
||||
}
|
||||
|
||||
internal static EditorCurveBinding Binding(AacConfiguration component, Type type, Transform transform, string propertyName)
|
||||
{
|
||||
return new EditorCurveBinding
|
||||
|
||||
Reference in New Issue
Block a user