UnrealEngine モジュールを使うときのメモ
必要になった背景
モジュール使ってますか? とりあえず今回 リプレイ機能を調査したかったので
#include "Runtime/NetworkReplayStreaming/NullNetworkReplayStreaming/Public/NullNetworkReplayStreaming.h"
を行いたかったのですが、NullNetworkReplayStreaming.h 内部でコンパイルエラーが出ます
#pragma once #include "NetworkReplayStreaming.h" #include "Core.h" #include "Engine.h" #include "ModuleManager.h" #include "UniquePtr.h" #include "OnlineJsonSerializer.h" #include "Tickable.h"
当然 内部ヘッダにはパス通ってませんね
パスを通さなければ。。。。
おそらく、プロジェクトパスに Runtime/NetworkReplayStreaming/NullNetworkReplayStreaming/
追加すればビルド通るとおもうけど、それは Unrealの流儀じゃないので 正しい方法で行う
ビルドシステム
プロジェクト名.Build.cs ってのがあるので そこを開く
// Fill out your copyright notice in the Description page of Project Settings. using UnrealBuildTool; public class プロジェクト名 : ModuleRules { public プロジェクト名(TargetInfo Target) { PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore" }); PrivateDependencyModuleNames.AddRange(new string[] { }); // Uncomment if you are using Slate UI // PrivateDependencyModuleNames.AddRange(new string[] { "Slate", "SlateCore" }); // Uncomment if you are using online features // PrivateDependencyModuleNames.Add("OnlineSubsystem"); // if ((Target.Platform == UnrealTargetPlatform.Win32) || (Target.Platform == UnrealTargetPlatform.Win64)) // { // if (UEBuildConfiguration.bCompileSteamOSS == true) // { // DynamicallyLoadedModuleNames.Add("OnlineSubsystemSteam"); // } // } } }
この PublicDependencyModuleNames.AddRange の配列が、それなので "NetworkReplayStreaming" を追加してビルドすると OK