Skip to content

Game.Prefabs.IconAnimationElement

Assembly: Assembly-CSharp (the game's runtime assembly that contains the Game namespace)
Namespace: Game.Prefabs

Type: struct

Base: Unity.Entities.IBufferElementData

Summary:
Represents a single element stored in an ECS dynamic buffer that describes an icon animation sample. Each element carries a duration and an AnimationCurve3 describing the animated values for that sample. The type is annotated with [InternalBufferCapacity(0)], which forces the buffer to allocate its storage externally (no inline capacity), making the buffer fully dynamic and stored in separate memory chunks.


Fields

  • public float m_Duration
    Duration of this animation sample in seconds. Typically used to determine how long this sample contributes to the overall icon animation.

  • public AnimationCurve3 m_AnimationCurve
    Holds the animation curve data for this sample. AnimationCurve3 is a project-specific type representing curve data (likely for 3 channels/axes). When using this struct in jobs/Burst, ensure AnimationCurve3 is compatible with unmanaged/Burst use (it may contain managed data).

Properties

  • None.
    This is a plain buffer element struct with public fields and no additional properties.

Constructors

  • public IconAnimationElement() (implicit default)
    No explicit constructors are declared. Use the default struct initializer or object initializer syntax to create instances.

Methods

  • None.
    No methods are defined on this struct — it is a simple POD-style buffer element intended for storage in DynamicBuffers.

Usage Example

// Add buffer to an entity and append animation elements
var entityManager = World.DefaultGameObjectInjectionWorld.EntityManager;
var entity = entityManager.CreateEntity();

// Ensure the buffer component exists on the entity
if (!entityManager.HasComponent<IconAnimationElement>(entity))
{
    entityManager.AddBuffer<IconAnimationElement>(entity);
}

var buffer = entityManager.GetBuffer<IconAnimationElement>(entity);

// Example: append an animation element (adjust AnimationCurve3 construction to your project)
buffer.Add(new IconAnimationElement
{
    m_Duration = 0.5f,
    m_AnimationCurve = new AnimationCurve3(/* ... initialize as appropriate ... */)
});

Notes and recommendations: - Because of [InternalBufferCapacity(0)], the buffer will always allocate external storage. This is appropriate when you expect variable and potentially large numbers of elements. - Verify that AnimationCurve3 is suitable for use in Jobs/Burst (must be unmanaged/blittable). If it contains managed references, avoid accessing it from Burst-compiled jobs. - Use DynamicBuffer in ECS systems to iterate and manipulate the animation samples efficiently.