Skip to content

Game.Prefabs.ProceduralAnimationProperties

Assembly: Assembly-CSharp (runtime assembly for Cities: Skylines 2 mods / game code)
Namespace: Game.Prefabs

Type: class

Base: ComponentBase

Summary:
Defines a prefab component that stores procedural animation bone definitions (BoneInfo[]) used by the engine to create/drive procedural bones on a prefab. During prefab conversion the class contributes a ProceduralBone component type so the prefab/Archetype will include procedural bone data for the ECS/renderer systems. The class itself is a plain data container intended to be serialized on a prefab and edited in the editor/inspector.


Fields

  • public BoneInfo[] m_Bones
    Array of bone definitions for this prefab. Each element describes a single bone (name, transform, bind pose, parent index, and runtime parameters for procedural animation). This array is serialized on the prefab and used by conversion/baking code to produce runtime procedural bone instances.

Nested type BoneInfo (public): - public string name
The bone name (string identifier) that can be used for mapping or debugging.

  • public Vector3 position
    Local position of the bone relative to its parent.

  • public Quaternion rotation
    Local rotation of the bone. Marked with an EulerAngles attribute in the source to indicate editor representation uses Euler angles.

  • public Vector3 scale
    Local scale of the bone.

  • public Matrix4x4 bindPose
    The bind pose matrix for skinning / initial bone transform.

  • public int parentId
    Index of the parent bone in m_Bones (or -1 for no parent). Used to reconstruct the bone hierarchy.

  • public BoneType m_Type
    Enumerated bone type (engine-specific enum) used to indicate special bone roles/behaviour for the procedural animation system.

  • public float m_Speed
    Procedural speed parameter for this bone (used by the procedural animation system).

  • public float m_Acceleration
    Procedural acceleration parameter for this bone.

  • public int m_ConnectionID
    ID used to connect this bone to other systems (e.g., connections between bones/prefabs). Semantic depends on engine usage.

  • public int m_SourceID
    Source identifier for the bone (engine-specific usage).

Properties

  • (None declared)
    This class exposes no public C# properties; it only contains public fields and overrides. Data is expected to be accessed directly via fields or through the prefab/inspector pipeline.

Constructors

  • public ProceduralAnimationProperties()
    No explicit constructor is defined in the source; the default parameterless constructor is provided by the compiler. Instances are typically created/serialized by Unity when attached to a prefab.

Methods

  • public override void GetArchetypeComponents(HashSet<ComponentType> components)
    This override is present but empty in the source. Intended to add ECS archetype component types when converting the component to an entity archetype; currently no archetype components are added here (behavior may be handled by GetPrefabComponents or other conversion helpers).

  • public override void GetPrefabComponents(HashSet<ComponentType> components)
    Adds the component type ComponentType.ReadWrite() to the provided components set. This ensures that the prefab conversion/baking pipeline will include a ProceduralBone component (read/write) on the resulting prefab archetype/entity so runtime systems that operate on ProceduralBone will run for this prefab.

Usage Example

// Example: create and populate ProceduralAnimationProperties on a prefab or via script
var prop = new ProceduralAnimationProperties();
prop.m_Bones = new ProceduralAnimationProperties.BoneInfo[]
{
    new ProceduralAnimationProperties.BoneInfo
    {
        name = "root",
        position = Vector3.zero,
        rotation = Quaternion.identity,
        scale = Vector3.one,
        bindPose = Matrix4x4.identity,
        parentId = -1,
        // m_Type should be set to an appropriate BoneType value defined by the game
        m_Speed = 1f,
        m_Acceleration = 0f,
        m_ConnectionID = -1,
        m_SourceID = -1
    }
};

// When the prefab is converted/baked, GetPrefabComponents will ensure a ProceduralBone
// component type is added to the prefab's component set so the procedural bone system
// receives the bone data at runtime.

Notes: - The class is decorated with [ComponentMenu("Rendering/", typeof(RenderPrefab))] in source; this places it in the editor component menu under Rendering and ties it to the RenderPrefab type for editor workflows. - BoneType and the ProceduralBone ECS type are engine-specific; consult the game's modding docs or other engine source to pick valid BoneType values and to learn how ProceduralBone is consumed at runtime.