协作头脑风暴
brainstorming
在实现前澄清需求、探索设计选择,并形成清晰的开发方向。
ue5-gamedev【开发与工程】Unreal Engine 5 game development: C++ coding, Blueprint creation, editor automation, and build management. Use when tasks involve writing UE5 C++ gameplay code, creating or modifying Blueprints, executing editor commands, triggering builds, or working with the UE5 project via Remote Control API, Python bridge, or MCP tools. Covers coding standards, U…
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
C++ coding, Blueprint authoring, editor automation, and build management for Unreal Engine 5 projects.
UE5 requires a machine with a capable GPU and sufficient RAM. Remote access to the editor is provided through multiple channels. Configure the following environment variables (or use the defaults shown):
| Service | Env Var | Default | Purpose |
|---|---|---|---|
| Remote Control API | UE5_REMOTE_CONTROL_HOST | localhost:8080 | Property access, function calls, editor control |
| UE5 Editor (Remote Exec) | UE5_PYTHON_BRIDGE_HOST | localhost:30010 | Python script execution inside editor |
| Bridge / Orchestrator (optional) | UE5_BRIDGE_HOST | localhost:8000 | Proxied UE5 commands from an orchestrator service |
Project path: Set UE5_PROJECT_PATH to your .uproject directory (e.g., D:\UnrealProjects\MyGame).
Follow Epic's conventions strictly:
F -- Structs (FVector, FHitResult, FMyStruct)U -- UObject-derived classes (UActorComponent, UMyComponent)A -- Actor-derived classes (ACharacter, AMyActor)E -- Enums (ECollisionChannel, EMyEnum)I -- Interfaces (IInteractable)T -- Templates (TArray, TMap, TSubclassOf)b -- Boolean variables (bIsAlive, bCanJump)// Editable in editor, visible in Blueprints
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Combat")
float MaxHealth = 100.f;
// Set in Blueprint, read-only in editor
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Status")
bool bIsAlive = true;
// Replicated property
UPROPERTY(ReplicatedUsing = OnRep_Health)
float Health;
// Not exposed, internal only
UPROPERTY()
float InternalTimer;
// Callable from Blueprints
UFUNCTION(BlueprintCallable, Category = "Combat")
void TakeDamage(float Amount);
// Implementable in Blueprints (no C++ body)
UFUNCTION(BlueprintImplementableEvent, Category = "Events")
void OnDeath();
// C++ default with Blueprint override option
UFUNCTION(BlueprintNativeEvent, Category = "Events")
void OnHit(const FHitResult& Hit);
// Server RPC
UFUNCTION(Server, Reliable, WithValidation)
void ServerFireWeapon();
TArray<T> -- Dynamic array (not std::vector)TMap<K, V> -- Hash map (not std::map)TSet<T> -- Hash setTSubclassOf<T> -- Type-safe class referenceTSoftObjectPtr<T> -- Lazy-loaded asset referenceTWeakObjectPtr<T> -- Non-owning referencenew/delete -- use NewObject<T>(), CreateDefaultSubobject<T>(), or smart pointersFString, FName, FText -- never std::stringconst correctness everywhere/** */ comments#pragma once (not include guards)| Class | Purpose | When to use |
|---|---|---|
AGameModeBase | Game rules, spawning | Match/session logic |
AGameStateBase | Shared game state | Score, match status |
APlayerController | Player input routing | Camera, input, HUD |
APlayerState | Per-player state | Player score, team |
APawn / ACharacter | Controllable entities | Players, NPCs |
UActorComponent | Logic components | Reusable behaviors |
USceneComponent | Spatial components | Transform hierarchy |
UGameInstanceSubsystem | Persistent systems | Save data, settings |
UWorldSubsystem | Per-world systems | Level-scoped logic |
The Remote Control API plugin exposes UE5 editor functionality over HTTP.
PUT http://localhost:8080/remote/object/property
{
"objectPath": "/Game/Maps/MainLevel.MainLevel:PersistentLevel.BP_Player_C_0",
"propertyName": "MaxHealth"
}
PUT http://localhost:8080/remote/object/property
{
"objectPath": "/Game/Maps/MainLevel.MainLevel:PersistentLevel.BP_Player_C_0",
"propertyName": "MaxHealth",
"propertyValue": { "MaxHealth": 200.0 }
}
PUT http://localhost:8080/remote/object/call
{
"objectPath": "/Game/Maps/MainLevel.MainLevel:PersistentLevel.BP_Player_C_0",
"functionName": "TakeDamage",
"parameters": { "Amount": 50.0 }
}
PUT http://localhost:8080/remote/search/object
{
"query": "BP_Player",
"class": "/Script/Engine.Actor",
"outerPath": "/Game/Maps/MainLevel"
}
PUT http://localhost:8080/remote/object/call
{
"objectPath": "/Script/Engine.Default__KismetSystemLibrary",
"functionName": "ExecuteConsoleCommand",
"parameters": {
"WorldContextObject": "/Game/Maps/MainLevel.MainLevel",
"Command": "stat fps"
}
}
UE5's Python Editor Script Plugin exposes the unreal module inside the editor. Execute Python remotely via port 30010.
import unreal
# Get the editor subsystem
editor = unreal.EditorLevelLibrary()
# Spawn an actor
location = unreal.Vector(0, 0, 100)
rotation = unreal.Rotator(0, 0, 0)
actor = editor.spawn_actor_from_class(unreal.StaticMeshActor, location, rotation)
# Set a mesh
mesh_component = actor.get_component_by_class(unreal.StaticMeshComponent)
mesh = unreal.EditorAssetLibrary.load_asset("/Engine/BasicShapes/Cube")
mesh_component.set_static_mesh(mesh)
# Find actors
actors = unreal.EditorLevelLibrary.get_all_level_actors()
player_starts = unreal.GameplayStatics.get_all_actors_of_class(
unreal.EditorLevelLibrary.get_editor_world(),
unreal.PlayerStart
)
# Asset operations
unreal.EditorAssetLibrary.rename_asset("/Game/Old/Path", "/Game/New/Path")
unreal.EditorAssetLibrary.duplicate_asset("/Game/Source", "/Game/Copy")
unreal.EditorAssetLibrary.delete_asset("/Game/Unused/Asset")
# Blueprint operations
factory = unreal.BlueprintFactory()
factory.set_editor_property("parent_class", unreal.Actor)
asset_tools = unreal.AssetToolsHelpers.get_asset_tools()
blueprint = asset_tools.create_asset("BP_MyActor", "/Game/Blueprints", None, factory)
# Uses UE5's remote_execution.py (bundled with Python Editor Script Plugin)
# Or use the upyrc package: pip install upyrc
import remote_execution
remote = remote_execution.RemoteExecution()
remote.start()
# Wait for node discovery
nodes = remote.remote_nodes
# Execute on first found editor
remote.run_command("print('Hello from external!')", exec_node=nodes[0])
remote.stop()
If you run a bridge or orchestrator service that proxies commands to the UE5 editor host, configure it with UE5_BRIDGE_HOST. This is useful when the machine running Claude Code is not the same machine running UE5, or when you want centralized command routing.
Example endpoints (adjust host/port to your setup):
# Check UE5 connectivity
GET http://localhost:8000/ue5/status
# Trigger a build
POST http://localhost:8000/ue5/build
{
"project_path": "D:\\UnrealProjects\\MyGame",
"config": "Development",
"platform": "Win64",
"cook_content": true
}
# Check build status
GET http://localhost:8000/ue5/build/{job_id}
# Execute editor command
POST http://localhost:8000/ue5/editor/command
{ "command": "open_level", "args": {"level": "/Game/Maps/MainLevel"} }
# List assets
GET http://localhost:8000/ue5/assets?path=/Game&asset_type=Blueprint
# Import asset
POST http://localhost:8000/ue5/import
{
"source_path": "\\\\server\\exports\\character.fbx",
"destination_path": "/Game/Characters/Imported"
}
These MCP servers provide additional UE5 integration capabilities:
Native C++ automation bridge.
npm install -g unreal-engine-mcp-serverRemote Control API based. Includes a pre-configured UE5.5 starter project.
Direct Python API access via MCP. Available on Fab Store.
unreal Python module access through MCPSource code analysis and understanding (read-only).
When creating or modifying Blueprints:
BlueprintCallable for functions, BlueprintReadWrite/BlueprintReadOnly for propertiesGET /ue5/status -- ensure editor is runningPOST /ue5/build with desired configGET /ue5/build/{job_id} for statuscurl http://localhost:8080/status