AnimationPlaybackManager<TKey>
public class AnimationPlaybackManager<TKey>Generic manager for handling multiple concurrent animation playbacks. Used by both Search grid and Project View overlay for animated preview playback.
Events
Section titled “Events”
OnAnimationLoaded
Section titled “OnAnimationLoaded”public event Action<TKey, bool> OnAnimationLoadedEvent fired when an animation finishes loading (success or failure). Parameters: key, success
Returns
System.Action{{TKey},System.Boolean} — No return description is available.
OnAnimationDisposed
Section titled “OnAnimationDisposed”public event Action<TKey> OnAnimationDisposedEvent fired when an animation is disposed. Parameter: key
Returns
System.Action{{TKey}} — No return description is available.
Properties
Section titled “Properties”
LoadedCount
Section titled “LoadedCount”public int LoadedCount { get; }Number of currently loaded and playing animations.
Returns
System.Int32 — No return description is available.
LoadingCount
Section titled “LoadingCount”public int LoadingCount { get; }Number of animations currently being loaded.
Returns
System.Int32 — No return description is available.
TotalActiveCount
Section titled “TotalActiveCount”public int TotalActiveCount { get; }Total count of loaded + loading animations.
Returns
System.Int32 — No return description is available.
LoadedKeys
Section titled “LoadedKeys”public IEnumerable<TKey> LoadedKeys { get; }Access to loaded animation player keys for iteration.
Returns
System.Collections.Generic.IEnumerable{{TKey}} — No return description is available.
Constructors
Section titled “Constructors”
AnimationPlaybackManager(int, Func, Func)
Section titled “AnimationPlaybackManager(int, Func, Func)”public AnimationPlaybackManager(int maxConcurrentLoads = 3, Func<bool> isEnabledCheck = null, Func<int> maxLoadedCheck = null)Creates a new AnimationPlaybackManager.
Parameters
| Name | Type | Description |
|---|---|---|
maxConcurrentLoads |
System.Int32 | Maximum number of animations to load simultaneously. |
isEnabledCheck |
System.Func{System.Boolean} | Optional function to check if animation playback is still enabled. If provided and returns false, loading animations will be discarded. |
maxLoadedCheck |
System.Func{System.Int32} | Optional function that returns the maximum number of loaded animations allowed. If provided, QueueAnimation will return false when at the limit. |
Methods
Section titled “Methods”
IsLoaded(TKey)
Section titled “IsLoaded(TKey)”public bool IsLoaded(TKey key)Checks if an animation is loaded for the given key.
Parameters
| Name | Type | Description |
|---|---|---|
key |
{TKey} |
Returns
System.Boolean — No return description is available.
IsLoading(TKey)
Section titled “IsLoading(TKey)”public bool IsLoading(TKey key)Checks if an animation is currently being loaded for the given key.
Parameters
| Name | Type | Description |
|---|---|---|
key |
{TKey} |
Returns
System.Boolean — No return description is available.
IsActive(TKey)
Section titled “IsActive(TKey)”public bool IsActive(TKey key)Checks if an animation is loaded or loading for the given key.
Parameters
| Name | Type | Description |
|---|---|---|
key |
{TKey} |
Returns
System.Boolean — No return description is available.
TryGetPlayer(TKey, out AnimationPlayer)
Section titled “TryGetPlayer(TKey, out AnimationPlayer)”public bool TryGetPlayer(TKey key, out AnimationPlayer player)Gets the animation player for a key if loaded.
Parameters
| Name | Type | Description |
|---|---|---|
key |
{TKey} | |
player |
AssetInventory.AnimationPlayer |
Returns
System.Boolean — No return description is available.
GetCurrentFrame(TKey)
Section titled “GetCurrentFrame(TKey)”public Texture2D GetCurrentFrame(TKey key)Gets the current frame texture for an animation if loaded.
Parameters
| Name | Type | Description |
|---|---|---|
key |
{TKey} |
Returns
UnityEngine.Texture2D — No return description is available.
QueueAnimation(TKey, AssetInfo)
Section titled “QueueAnimation(TKey, AssetInfo)”public bool QueueAnimation(TKey key, AssetInfo info)Queues an animation for loading if not already loaded or loading.
Parameters
| Name | Type | Description |
|---|---|---|
key |
{TKey} | The key to identify this animation. |
info |
AssetInventory.AssetInfo | The AssetInfo for the animation. |
Returns
System.Boolean — True if queued, false if already loaded/loading or at max capacity.
ClearQueue()
Section titled “ClearQueue()”public void ClearQueue()Clears the load queue. Useful when scroll position changes significantly. Does not affect currently loading or loaded animations.
CancelLoading(TKey)
Section titled “CancelLoading(TKey)”public void CancelLoading(TKey key)Marks a key as no longer needed for loading. If the animation is currently loading, it will be discarded when complete.
Parameters
| Name | Type | Description |
|---|---|---|
key |
{TKey} | |
ProcessQueue()
Section titled “ProcessQueue()”public void ProcessQueue()Processes the load queue, starting new loads up to the concurrent limit. Should be called regularly (e.g., from Update loop).
DisposeAnimation(TKey)
Section titled “DisposeAnimation(TKey)”public void DisposeAnimation(TKey key)Disposes a single animation by key.
Parameters
| Name | Type | Description |
|---|---|---|
key |
{TKey} | |
DisposeAll()
Section titled “DisposeAll()”public List<TKey> DisposeAll()Disposes all animations and clears the queue.
Returns
System.Collections.Generic.List{{TKey}} — List of keys that were disposed (useful for restoring static previews).
UpdateVisibility(Func<TKey, bool>, Action)
Section titled “UpdateVisibility(Func<TKey, bool>, Action)”public void UpdateVisibility(Func<TKey, bool> isVisible, Action<TKey> onDispose = null)Updates which animations should be active based on a visibility check. Disposes animations that are no longer visible and queues new ones.
Parameters
| Name | Type | Description |
|---|---|---|
isVisible |
System.Func{{TKey},System.Boolean} | Function to check if a key should still be visible/active. |
onDispose |
System.Action{{TKey}} | Optional callback when an animation is disposed for visibility reasons. |
HasAnimatedPreview(AssetInfo)
Section titled “HasAnimatedPreview(AssetInfo)”public static bool HasAnimatedPreview(AssetInfo info)Checks if a preview file exists for the given AssetInfo.
Parameters
| Name | Type | Description |
|---|---|---|
info |
AssetInventory.AssetInfo |
Returns
System.Boolean — No return description is available.