ue-statetree-smartobjects

ue-statetree-smartobjects is a skill for Claude Code, Codex from Cooperzheng/ue-dev-playbook. It costs 65 tokens per session (2,300 once invoked), scanned A, original, MIT.

A guide to Unreal Engine 5 StateTree and SmartObjects for building non-player character (NPC) behavior and interactions. StateTree is a hierarchical system for choosing and running behaviors; SmartObjects provide usable interaction slots in the game world.

In plain words
What is it for?
Creating NPC behavior, authoring StateTree tasks and evaluators in C++, configuring SmartObject slots, and connecting these systems through Blueprints.
Why use it?
It explains how to structure AI tasks, conditions, evaluators, and Blueprint connections instead of wiring these systems from guesswork.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Creating NPC behavior, authoring StateTree tasks and evaluators in C++, configuring SmartObject slots, and connecting these systems through Blueprints.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/cooperzheng/ue-dev-playbook/ue-statetree-smartobjects
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add Cooperzheng/ue-dev-playbook --skill ue-statetree-smartobjects
Clone the repo
git clone --depth 1 https://github.com/Cooperzheng/ue-dev-playbook

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for ue-statetree-smartobjects

README.md
[![agentmods](https://agentmods.dev/badge/skills/cooperzheng/ue-dev-playbook/ue-statetree-smartobjects/github.svg)](https://agentmods.dev/skills/cooperzheng/ue-dev-playbook/ue-statetree-smartobjects)
Your own site
<a href="https://agentmods.dev/skills/cooperzheng/ue-dev-playbook/ue-statetree-smartobjects"><img src="https://agentmods.dev/badge/skills/cooperzheng/ue-dev-playbook/ue-statetree-smartobjects/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for ue-statetree-smartobjects

Your own site · 80×15
<a href="https://agentmods.dev/skills/cooperzheng/ue-dev-playbook/ue-statetree-smartobjects"><img src="https://agentmods.dev/badge/skills/cooperzheng/ue-dev-playbook/ue-statetree-smartobjects.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 65 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,300 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00065 $0.02300
Opus 5 $0.00032 $0.01150
Sonnet 5 $0.00013 $0.00460
Haiku 4.5 $0.00006 $0.00230

Measured 8d ago against content hash 3d1b5c13d5ab, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-08, from the pricing page.

Security

Grade A, and why

ue-statetree-smartobjects scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 8d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/ue-statetree-smartobjects/SKILL.md · 337 lines

How it starts

The opening of the file, as written. The whole thing — 337 lines — stays where its author put it; the contents beside it link to each section on GitHub.

UE5 StateTree + SmartObjects 开发指南

一、StateTree 核心概念

StateTree 是 UE5 的层级状态机框架,结合行为树的选择器逻辑与传统状态机的状态/转换。

StateTree
├── State: Idle          ← 父状态(Selector 或 Sequence)
│   ├── Evaluator        ← 每帧更新共享数据(如感知结果)
│   ├── Task: WaitIdle   ← 执行具体行为
│   └── Transition → Patrol  [条件: !bEnemyVisible]
├── State: Patrol
│   ├── Task: MoveAlongPath
│   └── Transition → Chase   [条件: bEnemyVisible]
└── State: Chase
    ├── Task: MoveToTarget
    └── Transition → Attack   [条件: DistToTarget < 150]

关键类型

类型 基类 职责
Task FStateTreeTaskBase 执行具体行为(移动、播放动画等)
Evaluator FStateTreeEvaluatorBase 每帧更新共享上下文数据
Condition FStateTreeConditionBase 转换条件判断
Schema UStateTreeSchema 定义 StateTree 可访问的 Context 对象

二、C++ Task 编写模板

最小 Task 骨架

// MyAITask.h
#pragma once
#include "StateTreeTaskBase.h"
#include "MyAITask.generated.h"

USTRUCT()
struct FMyAITaskInstanceData
{
    GENERATED_BODY()

    // 输入参数(在 StateTree 编辑器中绑定)
    UPROPERTY(EditAnywhere, Category = "Input")
    float Duration = 2.f;

    // 运行时状态
    float ElapsedTime = 0.f;
};

USTRUCT(DisplayName = "My AI Task")
struct FMyAITask : public FStateTreeTaskBase
{
    GENERATED_BODY()

    using FInstanceDataType = FMyAITaskInstanceData;

    virtual const UStruct* GetInstanceDataType() const override
    {
        return FMyAITaskInstanceData::StaticStruct();
    }

    virtual EStateTreeRunStatus EnterState(
        FStateTreeExecutionContext& Context,
        const FStateTreeTransitionResult& Transition) const override;

    virtual EStateTreeRunStatus Tick(
        FStateTreeExecutionContext& Context,
        const float DeltaTime) const override;

    virtual void ExitState(
        FStateTreeExecutionContext& Context,
        const FStateTreeTransitionResult& Transition) const override;
};
// MyAITask.cpp
#include "MyAITask.h"

EStateTreeRunStatus FMyAITask::EnterState(
    FStateTreeExecutionContext& Context,
    const FStateTreeTransitionResult& Transition) const
{
    FMyAITaskInstanceData& Data = Context.GetInstanceData(*this);
    Data.ElapsedTime = 0.f;
    return EStateTreeRunStatus::Running;
}

EStateTreeRunStatus FMyAITask::Tick(
    FStateTreeExecutionContext& Context,
    const float DeltaTime) const
{
    FMyAITaskInstanceData& Data = Context.GetInstanceData(*this);
    Data.ElapsedTime += DeltaTime;

    if (Data.ElapsedTime >= Data.Duration)
    {
        return EStateTreeRunStatus::Succeeded;
    }
    return EStateTreeRunStatus::Running;
}

void FMyAITask::ExitState(
    FStateTreeExecutionContext& Context,
    const FStateTreeTransitionResult& Transition) const
{
    // 清理资源
}

Read the full file on GitHub · 337 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 8d ago First seen · 337 lines · 65 tokens per session scan A 3d1b5c13d5ab

Subscribe to this mod's changes

ue-statetree-smartobjects is a skill published in the GitHub repository Cooperzheng/ue-dev-playbook (5 stars, last pushed 5mo ago), licensed MIT. It adds 65 tokens to every session and 2,300 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.