# Find a glTF walk clip after Interchange renames it and switch it at runtime

- **Status:** Current.
- **Engine:** ue6-main `61e2877e1`, Linux x86_64, Epic clang 23.1.5.
- **Context:** Standalone UE6 editor commandlet and Linux Development package.
- **Prerequisites:** Interchange glTF import, PythonScriptPlugin, a skeletal mesh and matching animation sequences, and a native `USkeletalMeshComponent`.

## Symptom

The raw Styloo hen and rooster GLBs both contain an animation called `walk ` with one trailing space. The imported Unreal assets are `henwalk_` and `roosterwalk_`. Guessing the object path from the GLB clip name misses the assets.

The fallback path can fail too if it refers to a generated shape and colour combination the map kit never created. Coop Zero's first placement stopped with `RuntimeError: Expected StaticMesh at /Game/CoopZero/Placeholder/SM_Sphere_peach. Run the asset generation scripts first.`

## Smallest example / reproduction

Run the Python Interchange commandlet in the [glTF import recipe](/docs/recipes/headless-gltf-and-flat-placeholders/). After calling `import_asset_tasks`, enumerate the actual animation names and paths in `task.get_objects()`.

```python
for obj in task.get_objects():
    if isinstance(obj, unreal.AnimSequence):
        unreal.log(obj.get_path_name())
```

## Solution

In Coop Zero the hen's walk sequence loads at `/Game/CoopZero/ThirdParty/Styloo/hen/hen/SkeletalMeshes/henwalk_.henwalk_`. Keep the resulting sequence and the skeletal mesh in reflected object properties on the actor or its definition. Use a sequence whose skeleton matches the mesh. In native code, `PlayAnimation` selects single-node mode and plays the supplied animation. Read back the current animation from the instance when logging a switch.

```cpp
MeshComponent->PlayAnimation(bMoving ? Walk : Idle, true);
if (UAnimSingleNodeInstance* Instance = MeshComponent->GetSingleNodeInstance())
{
    if (const UAnimationAsset* Current = Instance->GetCurrentAsset())
    {
        UE_LOGF(LogTemp, Log, "Current animation: %ls", *Current->GetName());
    }
}
```

Call this when the movement state changes. For a simple static fallback, use a mesh from `/Engine/BasicShapes` and set the colour material on the preview component.

## Why it works

The editor imports Unreal objects with the pipeline's own names. Loading the discovered asset paths and saving hard references puts the sequences in reach of cooking. The active animation instance tracks the actual current clip.

## Verified

- **Evidence level:** runs in editor and runs in packaged build.
- **How:**
  - Runs in editor: The wrapped `UnrealEditor-Cmd CoopZero.uproject -run=PythonScript -Script=Scripts/build_slice_map.py -nullrhi -unattended` placement saved and reloaded both imports. The repeat logged `SLICE_BIRD actor=Hen1 name=Aster variant=hen idle=henidle walk=henwalk_` and `SLICE_BIRD actor=Rooster name=Basil variant=rooster idle=roosteridle walk=roosterwalk_`. See Coop Zero `Saved/step06-place-repeat.log:2679–2683`.
  - Runs in packaged build: The wrapped `Out/Linux/CoopZero.sh -RenderOffscreen -unattended -ExecCmds="t.MaxFPS 120,coop.timescale 0,delay 1 coop.timescale 30,delay 64 quit"` switched Aster from `mode=idle clip=henidle t=0.00` to `mode=walk clip=henwalk_ t=0.10` and back to `mode=idle clip=henidle t=0.80`. The staged UFS manifest lists both walk sequences. See Coop Zero `Saved/step06-packaged-baseline.log:1659,1852,1859`.
  - Runs in editor: A second map set the rooster walk path to a nonexistent asset and ran `UnrealEditor-Cmd CoopZero.uproject /Game/CoopZero/Placeholder/Step06Fallback -game -nullrhi`. Basil logged `CHICKEN_ANIM bird=Basil mode=walk clip=procedural t=0.10` and returned to procedural idle at 0.50. See Coop Zero `Saved/step06-fallback-game.log:2130,2193–2194`.
- **Date / by:** 2026-11-25, not recorded.

## Limits and assumptions

The asset names and paths are specific to these local files and the tested import configuration. The package log establishes the active clip, while pose appearance awaits visual review.

The source notes labelled the two game runs "Works in packaged gameplay" and "Works in editor gameplay". Both were unattended launches driven by console commands, with no human play recorded, so this entry states them as runs in packaged build and runs in editor.
