Add AacFlBase.DuplicateAsset

This commit is contained in:
Haï~
2023-10-02 04:53:27 +02:00
parent 207d94cf30
commit 3d13898ab2
2 changed files with 17 additions and 0 deletions
+7
View File
@@ -4,6 +4,7 @@ using System.Linq;
using UnityEditor;
using UnityEditor.Animations;
using UnityEngine;
using Object = UnityEngine.Object;
// ReSharper disable once CheckNamespace
namespace AnimatorAsCode.V1
@@ -339,6 +340,12 @@ namespace AnimatorAsCode.V1
.WithUnit(unit, keyframes => keyframes.Constant(0, 0f).Constant(numberOf, 0f)));
}
/// Duplicate a new asset into the container and return it. For example, use this to create modified material variants. This asset will be removed the same way as other generated assets.
public T DuplicateAsset<T>(T assetToDuplicate) where T : Object
{
return AacInternals.DuplicateAssetIntoContainer(_configuration, assetToDuplicate);
}
// For backwards compatibility, generates an animation with 2 keyframes that are at a distance of 1 / 60 of 1 frame,
// that is 1 / 3600 seconds.
// This was due to DummyClipLasting returning a clip with unit conversion applied twice,