EP.02 (), EP.03 () と続いて、本 EP は 5 × 。 連動度は ★3 と前 2 者に劣りますが、フォトリアル 3D / コンソール対応 / 大規模配信を考えると候補に入る選択肢。 とのハイブリッド設計が鍵。
1. Unreal で LLM が活躍する場所
| 対象 | LLM 連動度 | 備考 |
|---|---|---|
| C++ コード | 高 | AActor / UComponent / Subsystem のボイラープレート生成が特に効く |
| Editor Utility Scripts (Python) | 高 | アセット一括処理、ビルド自動化 |
| Material Editor | 低 | ノードベース GUI、LLM 直接編集不可 |
| Blueprint | 低 | ビジュアルスクリプト、生成は困難 |
| Niagara (VFX) | 低 | ノードベース、パラメータ提案までは可 |
| Sequencer (シネマティック) | 中 | Python API 経由で操作可能 |
2. C++ コード生成の典型例 (AActor)
#pragma once
#include "CoreMinimal.h"#include "GameFramework/Pawn.h"#include "MyPawn.generated.h"
UCLASS()class MYGAME_API AMyPawn : public APawn{ GENERATED_BODY()
public: AMyPawn();
UPROPERTY(EditAnywhere, Category = "Movement") float Speed = 600.0f;
protected: virtual void BeginPlay() override; virtual void Tick(float DeltaTime) override; virtual void SetupPlayerInputComponent(UInputComponent* PlayerInputComponent) override;
private: void MoveForward(float Value); void MoveRight(float Value);
UPROPERTY(VisibleAnywhere, Category = "Components") UStaticMeshComponent* MeshComponent;};#include "MyPawn.h"#include "Components/InputComponent.h"
AMyPawn::AMyPawn(){ PrimaryActorTick.bCanEverTick = true;
MeshComponent = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("MeshComponent")); RootComponent = MeshComponent;}
void AMyPawn::BeginPlay(){ Super::BeginPlay();}
void AMyPawn::Tick(float DeltaTime){ Super::Tick(DeltaTime);}
void AMyPawn::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent){ Super::SetupPlayerInputComponent(PlayerInputComponent); PlayerInputComponent->BindAxis("MoveForward", this, &AMyPawn::MoveForward); PlayerInputComponent->BindAxis("MoveRight", this, &AMyPawn::MoveRight);}
void AMyPawn::MoveForward(float Value){ AddActorLocalOffset(FVector(Value * Speed * GetWorld()->GetDeltaSeconds(), 0, 0));}
void AMyPawn::MoveRight(float Value){ AddActorLocalOffset(FVector(0, Value * Speed * GetWorld()->GetDeltaSeconds(), 0));}UE 5.1 から Input System が刷新された。`PlayerInputComponent->BindAxis` は旧 API。新規プロジェクトは `Enhanced Input` (Input Action / Input Mapping Context) を使う。Claude に「UE5.3 で Enhanced Input を使って」 と指示すれば対応してくれる。
3. Editor Utility Scripts (Python)
Unreal は Editor 内で Python が動く。アセット一括処理 / ビルド自動化 / テスト実行などを Claude に書かせて、Editor 経由で実行できる。
import unreal
@unreal.uclass()class AutoLODGenerator(unreal.Object):
@unreal.ufunction(callable=True) def add_lods_to_all_meshes(self, asset_path: str = "/Game/Meshes"): asset_registry = unreal.AssetRegistryHelpers.get_asset_registry() assets = asset_registry.get_assets_by_path(asset_path, recursive=True)
for asset_data in assets: asset = asset_data.get_asset() if isinstance(asset, unreal.StaticMesh): # LOD0 から 50% / 25% / 12% のスクリーンサイズ閾値で LOD 追加 unreal.EditorStaticMeshLibrary.set_lods(asset, unreal.EditorScriptingMeshReductionOptions( auto_compute_lod_screen_size=False, reduction_settings=[ unreal.EditorScriptingMeshReductionSettings(percent_triangles=0.5), unreal.EditorScriptingMeshReductionSettings(percent_triangles=0.25), unreal.EditorScriptingMeshReductionSettings(percent_triangles=0.12), ] )) unreal.log(f"Added LODs to {asset.get_name()}")
# 実行: Editor → Window → Output Log → コンソールで:# AutoLODGenerator().add_lods_to_all_meshes("/Game/Meshes")4. Blueprint との付き合い方
- Blueprint で組んだロジックを Claude が C++ に書き起こす: スクリーンショットを貼って「これを C++ で同等に」
- 逆 (C++ → Blueprint) は不可、Editor で手動
- C++ Component + Blueprint Wrapper: 主要ロジックを C++、レベル固有のチューニングを Blueprint
- Blueprint to Text Plugin (Marketplace) で Blueprint を可読テキスト化 → LLM が読める
5. MetaHuman + LLM の組合せ
- MetaHuman Creator で人物アセット作成 (顔・髪・衣装を Web ベースで)
- LLM で台詞・性格設定 → MetaHuman Audio-Driven Animation で口パク自動
- OpenAI Realtime API / Anthropic で対話、ElevenLabs で音声化、MetaHuman で表示 → AI NPC
- 注意: フォトリアル人物 + LLM 対話は「Uncanny Valley」を起こしやすい、用途設計が重要
6. Nanite / Lumen と LLM
Nanite (仮想化ジオメトリ) と Lumen (リアルタイム GI) は UE5 の目玉機能。LLM の役割は限定的 (パラメータ調整推奨くらい) だが、「Lumen のチラつきを抑えたい、設定どうする」 のような質問には Claude が UE5 ドキュメント情報をベースに答えられる。
7. ビルド・パッケージ自動化
# Mac/Linux 例./Engine/Build/BatchFiles/RunUAT.sh BuildCookRun \ -project="/path/to/MyGame.uproject" \ -platform=Mac \ -configuration=Shipping \ -cook -allmaps -build -stage -pak -archive \ -archivedirectory="/path/to/Output"
# Windows./Engine/Build/BatchFiles/RunUAT.bat BuildCookRun \ -project="C:\Path\MyGame.uproject" \ -platform=Win64 -configuration=Shipping \ -cook -allmaps -build -stage -pak -archive \ -archivedirectory="C:\Output"8. ハマりどころ
| 問題 | 対処 |
|---|---|
| UCLASS / UPROPERTY マクロ忘れ | リフレクション効かず Blueprint から見えない |
| GENERATED_BODY() 漏れ | コンパイルエラー、コピペ忘れ |
| Hot Reload 不安定 | Live Coding 推奨、駄目なら Editor 再起動 |
| GC で UObject 消える | UPROPERTY() で保持、TWeakObjectPtr で参照 |
| Header 循環依存 | Forward declaration + .cpp での include |
| Engine バージョンアップでビルド壊れる | .uproject の EngineAssociation を慎重に変更 |
9. 次の話
EP.05 は pygame で学ぶ LLM 開発の全工程 ── 一番シンプルな環境で、仕様策定 → 実装 → 配布まで Claude と一緒に進めるサンプル。教育・プロトタイプの定番。
この記事の感想を教えてください
あなたの 1 クリックで、本当にこの記事は更新されます。「もっと詳しく」「続編希望」が一定数集まった記事は、 ふくふくが 実際に内容を拡充したり続編記事を公開 します。 送信したリアクションはお使いのブラウザに記録され、再カウントされません。