Allow any object to be an asset container:
- Asset containers are no longer restricted to the AnimatorController class when using the new GenericAssetContainer configuration field - The asset container will not be used if it is not a persistent asset
This commit is contained in:
@@ -26,10 +26,18 @@ namespace AnimatorAsCode.V1
|
||||
public Transform AnimatorRoot;
|
||||
public Transform DefaultValueRoot;
|
||||
public AnimatorController AssetContainer;
|
||||
public Object GenericAssetContainer;
|
||||
public string AssetKey;
|
||||
public IAacDefaultsProvider DefaultsProvider;
|
||||
public Dictionary<Type, object> AdditionalData; // Nullable
|
||||
|
||||
public Object GetPersistentAssetContainer()
|
||||
{
|
||||
var container = AssetContainer != null ? AssetContainer : GenericAssetContainer;
|
||||
if (container != null && EditorUtility.IsPersistent(container)) return container;
|
||||
return null;
|
||||
}
|
||||
|
||||
public AacConfiguration WithAdditonalData(Type key, object value)
|
||||
{
|
||||
var conf = this;
|
||||
@@ -413,7 +421,7 @@ namespace AnimatorAsCode.V1
|
||||
/// Removes all assets from the asset container matching the specified asset key.
|
||||
public void ClearPreviousAssets()
|
||||
{
|
||||
var allSubAssets = AssetDatabase.LoadAllAssetsAtPath(AssetDatabase.GetAssetPath(_configuration.AssetContainer));
|
||||
var allSubAssets = AssetDatabase.LoadAllAssetsAtPath(AssetDatabase.GetAssetPath(_configuration.GetPersistentAssetContainer()));
|
||||
foreach (var subAsset in allSubAssets)
|
||||
{
|
||||
if (subAsset.name.StartsWith($"zAutogenerated__{_configuration.AssetKey}__")
|
||||
|
||||
Reference in New Issue
Block a user