Token导航 LogoToken导航

Agent Skill · 待分类

ue-state-trees(美国州树)

ue-state-trees 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

ue-state-trees 是待分类类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为接触敏感数据;许可证信息还不明确,第三方扫描已通过,按安装量在待分类类的 11,209 个 Skill 里排第 2,062。

总安装 1,922周安装 77GitHub Stars 125下载 622核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
unknown

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:ue-state-trees(美国州树)
来源仓库:https://github.com/quodsoler/unreal-engine-skills
仓库路径:skills/ue-state-trees
安装命令:
npx skills add https://github.com/quodsoler/unreal-engine-skills --skill ue-state-trees
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/quodsoler/unreal-engine-skills --skill ue-state-trees

这个 Skill 是做什么的

这个 Skill 的分类还没最终确定,用法以来源仓库的说明为准。

ue-state-trees 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息。适合在 Codex、Claude、Cursor、Gemini CLI 中围绕仓库状态、代码变更或协作事项进行整理。

通过 npx skills add 命令从指定仓库安装,需结合原始 README 核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。当前无原始 SKILL.md 内容可参考,功能以实际实现为准。

来源仓库内路径:skills/ue-state-trees

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/quodsoler/unreal-engine-skills --skill ue-stat…;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要接触敏感数据,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

ue-state-trees 怎么安装?

在终端执行 npx skills add https://github.com/quodsoler/unreal-engine-skills --skill ue-state-trees。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

ue-state-trees 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

ue-state-trees 需要什么权限?

权限级别是接触敏感数据。该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

ue-state-trees 是免费的吗?

公开资料没有标注明确许可证,收费和商用限制都无法确认。正式使用前请到来源仓库核对授权说明。

ue-state-trees 用的人多吗?

公开数据是累计安装 1,922 次,近一周安装 77 次,下载 622 次,GitHub 125 星。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

ue-state-trees 安全吗?

第三方扫描结果为通过,但这只覆盖已知的静态检查项,不能替代自己读一遍源码和安装命令。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。
  • 第三方扫描已通过,常见的高风险行为没有命中。

先想清楚的地方

  • 需要接触敏感数据,装到常用环境前要先评估影响面。
  • 许可证没有明确标注,能不能商用、能不能再分发都不确定。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理待分类类任务、又不想每次都手写提示词的人。

不太适合

  • 环境里有大量密钥、凭证,不方便给第三方 Skill 读取的人。
  • 需要明确授权才能用到公司项目里的场景。
  • 需要厂商级技术支持和 SLA 的生产系统。

待分类类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
infsh-cli

infsh CLI · Codex、Claude

4,374,576382权限未标注未明确未收录
ai-video-generation

AI 视频生成 · Codex、Claude

4,313,376382调用外部服务未明确有提醒
lark-openapi-explorer

云雀 OpenAPI 浏览器 · Codex、Claude

2,064,1209,011需要联网未明确有提醒
lark-workflow-standup-report

Lark 工作流程站立报告 · Codex、Claude

2,041,6328,978需要联网未明确通过
use-my-browser

使用我的浏览器 · Codex、Claude

1,848,49140操作浏览器未明确未通过
ue-state-trees

美国州树 · 本页

1,922125接触敏感数据未明确通过

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

UE State Trees

You are an expert in Unreal Engine's State Tree system for building flexible, data-driven state machines.

Context Check

Read .agents/ue-project-context.md to determine:

  • Whether StateTreeModule and GameplayStateTreeModule plugins are enabled
  • If Mass Entity integration is needed (MassEntity, MassAIBehavior plugins)
  • Existing AI frameworks — behavior trees, custom FSMs to migrate from
  • Schema types in use and any custom schemas

Information Gathering

Before implementing, clarify:

  1. What is the use case? (AI behavior, game logic, UI state, entity processing)
  2. What scale? (single actor with UStateTreeComponent vs thousands of Mass entities)
  3. How complex? (simple linear FSM vs hierarchical states with linked subtrees)
  4. Are there existing behavior trees to migrate from?
  5. What external data do tasks need? (actor references, subsystems, world state)

StateTree Architecture

A State Tree is a hierarchical finite state machine authored as a UStateTree data asset:

UStateTree (UDataAsset)
  ├── UStateTreeSchema         ← defines allowed context/external data
  ├── States[]                 ← hierarchical state tree
  │     ├── Tasks[]            ← work performed while state is active
  │     ├── Transitions[]      ← rules for leaving this state
  │     └── Conditions[]       ← gates on transitions
  ├── Evaluators[]             ← global data providers (tick before transitions)
  └── Parameters               ← FInstancedPropertyBag default inputs

Runtime flow per tick: 1) Evaluators tick, 2) Transitions checked from active leaf up to root, 3) If transition fires: ExitState on old tasks then EnterState on new, 4) Active tasks tick.

Key classes:

ClassRole
UStateTreeData asset — call IsReadyToRun() before execution
FStateTreeExecutionContextPer-tick context — constructed each frame, NOT persisted
FStateTreeInstanceDataPersistent runtime state — survives across ticks
UStateTreeComponentActor component that manages tree lifecycle
EStateTreeRunStatusRunning, Stopped, Succeeded, Failed, Unset

Build.cs modules: StateTreeModule, GameplayStateTreeModule

The execution context is constructed per-tick from persistent instance data:

FStateTreeInstanceData InstanceData;  // persists across frames
// Each tick:
FStateTreeExecutionContext Context(Owner, *StateTree, InstanceData);
Context.Tick(DeltaTime);

This separates mutable state (FStateTreeInstanceData) from stateless execution logic, making State Trees safe for parallel evaluation in Mass Entity scenarios.


Schema System

Schemas define what context data a State Tree can access, constraining valid tasks and conditions. This prevents authoring errors at edit time rather than runtime.

SchemaContext ProvidedUse Case
UStateTreeComponentSchemaActor + BrainComponentGeneral actor logic
UStateTreeAIComponentSchemaAbove + AIControllerClassAI behavior
UMassStateTreeSchemaMass entity contextMass Entity processing

UStateTreeComponentSchema exposes ContextActorClass (TSubclassOf<AActor>) so the editor knows which components are available for property binding. UStateTreeAIComponentSchema extends it with AIControllerClass (TSubclassOf<AAIController>).

Custom Schemas

Subclass UStateTreeSchema for project-specific trees:

UCLASS()
class UMyGameSchema : public UStateTreeSchema
{
    GENERATED_BODY()
public:
    virtual bool IsStructAllowed(const UScriptStruct* InStruct) const override;
    virtual bool IsExternalItemAllowed(const UStruct& InStruct) const override;
    virtual TConstArrayView<FStateTreeExternalDataDesc> GetContextDataDescs() const override;

#if WITH_EDITOR
    virtual bool AllowEvaluators() const override { return true; }
    virtual bool AllowMultipleTasks() const override { return true; }
    virtual bool AllowGlobalParameters() const override { return true; }
#endif // WITH_EDITOR
};

Override GetContextDataDescs() to declare context objects (actor refs, subsystems). The editor uses this to validate property bindings.


Tasks

Tasks are the primary work units in a state. They are USTRUCTs (not UObjects), making them lightweight and cache-friendly.

FStateTreeTaskBase API

Key virtuals (all const — tasks are immutable at runtime):

VirtualReturnsCalled When
EnterState(Context, Transition)EStateTreeRunStatus (default: Running)State becomes active
ExitState(Context, Transition)voidState is exited
Tick(Context, DeltaTime)EStateTreeRunStatus (default: Running)Each frame (if bShouldCallTick)
StateCompleted(Context, Status, CompletedStates)voidChild state completes (REVERSE order)
TriggerTransitions(Context)voidOnly if bShouldAffectTransitions

Behavioral Flags

FlagDefaultPurpose
bShouldStateChangeOnReselecttrueExit+Enter when transitioning to same state
bShouldCallTicktrueEnable per-frame Tick calls
bShouldCallTickOnlyOnEventsfalseTick only when events are pending
bShouldCopyBoundPropertiesOnTicktrueRefresh property bindings each tick
bShouldAffectTransitionsfalseEnable TriggerTransitions calls

Set bShouldCallTick = false for fire-and-forget tasks that only need EnterState/ExitState.

Instance Data Pattern

Tasks are const at runtime — mutable per-instance state lives in a separate struct via the typedef FInstanceDataType pattern:

USTRUCT()
struct FMyTaskInstanceData
{
    GENERATED_BODY()
    float ElapsedTime = 0.f;
};

USTRUCT(meta=(DisplayName="My Custom Task"))
struct FMyTask : public FStateTreeTaskBase
{
    GENERATED_BODY()
    typedef FMyTaskInstanceData FInstanceDataType;  // required — framework allocates storage

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

    virtual EStateTreeRunStatus Tick(FStateTreeExecutionContext& Context,
        float DeltaTime) const override
    {
        FInstanceDataType& Data = Context.GetInstanceData(*this);
        Data.ElapsedTime += DeltaTime;
        return Data.ElapsedTime >= Duration
            ? EStateTreeRunStatus::Succeeded : EStateTreeRunStatus::Running;
    }

    UPROPERTY(EditAnywhere, Category = "Parameter")
    float Duration = 2.0f;
};

See references/state-tree-patterns.md for complete task, condition, and evaluator templates.

Multiple Tasks Per State

When AllowMultipleTasks() is true, a state runs several tasks simultaneously. Any task returning Failed fails the state immediately; all must return Succeeded for the state to succeed.


Conditions

Conditions gate transitions — evaluated to determine whether a transition should fire.

USTRUCT(meta=(Hidden))
struct FStateTreeConditionBase : public FStateTreeNodeBase
{
    virtual bool TestCondition(FStateTreeExecutionContext& Context) const;  // default: false
    EStateTreeExpressionOperand Operand = EStateTreeExpressionOperand::And;
    int8 DeltaIndent = 0;  // indent level for logical grouping
    EStateTreeConditionEvaluationMode EvaluationMode = EStateTreeConditionEvaluationMode::Evaluated;
};

Operands: And (both must be true), Or (either), Copy (hidden/internal). DeltaIndent creates logical grouping — conditions at the same indent level are evaluated together, enabling (A AND B) OR (C AND D) without nesting.

Built-in conditions: FStateTreeCompareIntCondition, FStateTreeCompareFloatCondition, FStateTreeCompareEnumCondition, FGameplayTagMatchCondition, FStateTreeObjectIsValidCondition, FStateTreeCompareDistanceCondition. Bind inputs via property bindings.


Evaluators

Evaluators run globally (not per-state) and execute before transitions and task ticks each frame. They inject external world data into the tree via property bindings, decoupling tasks from direct world queries.

USTRUCT(meta=(Hidden))
struct FStateTreeEvaluatorBase : public FStateTreeNodeBase
{
    virtual void TreeStart(FStateTreeExecutionContext& Context) const;
    virtual void TreeStop(FStateTreeExecutionContext& Context) const;
    virtual void Tick(FStateTreeExecutionContext& Context, float DeltaTime) const;
    // Note: DeltaTime is 0 during preselection
};

Evaluators use the same FInstanceDataType typedef pattern as tasks. Their instance data properties can be bound to task/condition inputs in the editor: Evaluator populates data, tasks/conditions read it.

When to use evaluators vs external data: Evaluators for data that changes every frame (nearest enemy, world time). External data handles for stable references (owning actor, subsystem).


Transitions

Transitions define how and when states change. Each state has an ordered list evaluated top-to-bottom — the first matching transition fires.

Trigger Types

EStateTreeTransitionTrigger is a bitmask (ENUM_CLASS_FLAGS, supports bitwise OR):

TriggerValueFires When
OnStateSucceeded1Active state returns Succeeded
OnStateFailed2Active state returns Failed
OnStateCompleted3Either Succeeded or Failed (1\2)
OnTick4Every frame (gate with conditions)
OnEvent8Matching event in the queue
OnDelegate16Bound delegate fires

Priorities and Properties

EStateTreeTransitionPriority: Low, Normal, Medium, High, Critical. Higher-priority transitions on child states evaluate before lower-priority ones on parents.

PropertyDefaultPurpose
bConsumeEventOnSelecttrueRemove event from queue when transition fires
bTransitionEnabledtrueDisable without removing
bReactivateTargetStatefalseForce Exit+Enter even if target is current state

Targets: GotoState (specific named state), NextState (next sibling), Succeeded/Failed (complete parent with that status), or tree-root Succeeded/Failed to complete the entire tree.


State Types and Selection

State Types

TypePurpose
StateNormal state with tasks, conditions, transitions
GroupContainer for child states — no tasks of its own
LinkedReferences another state within the same tree
LinkedAssetReferences a state in a different UStateTree asset
SubtreeEmbeds another UStateTree as a child

LinkedAsset is useful for sharing common behavior patterns (patrol, investigate, flee) across AI archetypes.

Selection Behavior

EStateTreeStateSelectionBehavior controls how child states are chosen on entry:

BehaviorEffect
TryEnterStateEnter this state directly
TrySelectChildrenInOrderTry children top-to-bottom, first valid wins
TrySelectChildrenAtRandomRandom child selection
TrySelectChildrenWithHighestUtilityUtility-based selection (highest score)
TrySelectChildrenAtRandomWeightedByUtilityWeighted random by utility score
TryFollowTransitionsFollow transition chain

FStateTreeActiveStates::MaxStates = 8 — maximum depth of active state hierarchy. Stay within this limit.


Events

State Trees use a GameplayTag-based event system for decoupled communication.

FStateTreeEvent contains: FGameplayTag Tag, FInstancedStruct Payload (optional typed data), FName Origin (optional sender name for debugging).

// From outside via UStateTreeComponent
TreeComp->SendStateTreeEvent(FGameplayTag::RequestGameplayTag("AI.Alert"));

// With payload
FMyAlertData AlertData;
AlertData.ThreatLevel = 5;
TreeComp->SendStateTreeEvent(
    FGameplayTag::RequestGameplayTag("AI.Alert"),
    FConstStructView::Make(AlertData), TEXT("PerceptionSystem"));

// From inside a task via execution context
Context.SendEvent(Tag, FConstStructView::Make(ResultData), TEXT("MyTask"));

FStateTreeEventQueue holds up to MaxActiveEvents = 64 events per tick. Events are processed during transition evaluation. Use bConsumeEventOnSelect = true (default) to prevent one event triggering multiple transitions.


External Data

External data provides typed references to objects outside the tree (actors, components, subsystems) without going through evaluators.

// Declare handles in your task/condition/evaluator struct
TStateTreeExternalDataHandle<FMyActorContext, EStateTreeExternalDataRequirement::Required> ActorHandle;
TStateTreeExternalDataHandle<FMySubsystemContext, EStateTreeExternalDataRequirement::Optional> SubsystemHandle;

// Link in the Link override
virtual bool Link(FStateTreeLinker& Linker) override
{
    Linker.LinkExternalData(ActorHandle);
    Linker.LinkExternalData(SubsystemHandle);
    return true;
}

// Access at runtime
auto& ActorCtx = Context.GetExternalData(ActorHandle);       // Required — reference
auto* SubsystemCtx = Context.GetExternalDataPtr(SubsystemHandle);  // Optional — pointer

The schema's CollectExternalData populates these handles at tree start, validating at link time rather than runtime.


UStateTreeComponent

UStateTreeComponent extends UBrainComponent and manages the full tree lifecycle on an actor.

void SetStateTree(UStateTree* NewStateTree);
void SetStateTreeReference(FStateTreeReference NewStateTreeRef);
void SendStateTreeEvent(const FStateTreeEvent& Event);
void SendStateTreeEvent(FGameplayTag Tag, FConstStructView Payload, FName Origin);
EStateTreeRunStatus GetStateTreeRunStatus() const;
// Delegate — fires when run status changes
FStateTreeRunStatusChanged OnStateTreeRunStatusChanged;  // BlueprintAssignable
bool bStartLogicAutomatically = true;  // EditAnywhere

FStateTreeReference

FStateTreeReference wraps a UStateTree* with parameter overrides:

FStateTreeReference TreeRef;
TreeRef.SetStateTree(MyStateTreeAsset);
TreeRef.SyncParameters();
TreeRef.GetParameters().SetValueFloat(TEXT("AggroRange"), 1500.f);

FStateTreeReferenceOverrides swaps tree references at runtime by tag:

Overrides.AddOverride(Tag_CombatVariant, CombatTreeRef);
Overrides.RemoveOverride(Tag_CombatVariant);

Subclass UStateTreeComponent to customize context via SetContextRequirements(FStateTreeExecutionContext&, bool bLogErrors) and CollectExternalData(...).


AI Integration

UStateTreeAIComponentSchema adds AIControllerClass to the component schema, making the AI controller available as context data for property bindings.

AMyAIController::AMyAIController()
{
    StateTreeComp = CreateDefaultSubobject<UStateTreeComponent>(TEXT("StateTree"));
    StateTreeComp->bStartLogicAutomatically = true;
}

Assign the UStateTree asset in the controller defaults. Set the schema's ContextActorClass to your Pawn class so the editor can bind to its components.

State Tree vs Behavior Tree

AspectState TreeBehavior Tree
StructureHierarchical FSM with transitionsTree of composites, decorators, tasks
Data flowEvaluators + property bindings (typed)Blackboard (string-keyed, loosely typed)
ConditionsFirst-class on transitionsDecorators on tree nodes
Mass EntityNative via UMassStateTreeSchemaNo Mass support
Best forData-driven FSMs, Mass entities, flat logicDeep decision hierarchies, complex aborts

Prefer State Trees for new AI needing Mass Entity scaling or data-driven transitions. Keep Behavior Trees for deeply nested decision logic with complex abort/decorator patterns.


Mass Entity Integration

State Trees integrate natively with Mass Entity for processing thousands of entities. See references/state-tree-mass-integration.md for complete setup.

Key concepts:

  • UMassStateTreeSchema constrains trees to Mass-compatible node types (FMassStateTreeTaskBase, etc.)
  • UMassStateTreeSubsystem manages pooled instance data (AllocateInstanceData/FreeInstanceData)
  • UMassStateTreeProcessor evaluates trees per entity each frame
  • FMassStateTreeExecutionContext wraps execution context with SetEntity/GetEntity
  • Mass-specific tasks override GetDependencies(UE::MassBehavior::FStateTreeDependencyBuilder&) to declare fragment read/write requirements

For Mass Entity architecture details, see ue-mass-entity.


Common Mistakes

Persisting FStateTreeExecutionContext across frames:

// WRONG — context is per-tick, NOT persistent
FStateTreeExecutionContext* SavedContext;  // dangling after tick

// RIGHT — reconstruct each tick from persistent instance data
FStateTreeExecutionContext Context(Owner, *StateTree, InstanceData);
Context.Tick(DeltaTime);

Mutating task struct directly instead of using instance data:

// WRONG — task structs are const at runtime
virtual EStateTreeRunStatus Tick(...) const override {
    Timer += DeltaTime;  // compile error — 'this' is const
}

// RIGHT — use FInstanceDataType typedef
typedef FMyInstanceData FInstanceDataType;
virtual EStateTreeRunStatus Tick(...) const override {
    auto& Data = Context.GetInstanceData(*this);
    Data.Timer += DeltaTime;
}

Conditions with side effects: TestCondition may be called multiple times per frame during transition evaluation. Never modify state in conditions — they must be pure functions.

Evaluators doing heavy work every tick: Evaluators run every frame before transitions. Cache results in instance data and only refresh when inputs change.

Exceeding MaxStates depth: FStateTreeActiveStates::MaxStates = 8. Deeply nested hierarchies silently fail. Flatten with linked states or subtrees.

Forgetting to link external data: Unlinked Required handles assert at runtime; Optional handles silently return nullptr. Always link all declared handles in Link().

Not consuming events: With bConsumeEventOnSelect = false, the same event can trigger multiple transitions in one frame. Leave default true unless broadcast behavior is intended.


Related Skills

  • ue-ai-navigation — Behavior tree patterns, AI controller setup, perception system
  • ue-mass-entity — Mass Entity architecture, processors, fragments, traits
  • ue-gameplay-abilities — Ability-driven state transitions, GAS integration
  • ue-gameplay-framework — Game state machines, controller/pawn lifecycle
  • ue-actor-component-architecture — Component setup for UStateTreeComponent
  • ue-cpp-foundations — USTRUCT patterns, delegates, subsystem access

平台分布

Codex

37.55%
按下载量换算234

Claude

28.12%
按下载量换算175

Cursor

17.75%
按下载量换算110

Gemini CLI

9.06%
按下载量换算56

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

接触敏感数据

该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。目前只有一个公开来源,建议同时核对源仓库。

继续浏览同类 Skills