Hi,
I have encountered an trying to build a dedicated server for a 4.18 project. The engine was built from source, then a binary version was created from that.
My problem is the content of the “MyGame.Server.Target.cs” file located in the MyGame/Source folder.
I am following this guide: https://wiki.unrealengine.com/Dedica…ows_%26_Linux)
The guide suggests using the following lines:
using UnrealBuildTool;
using System.Collections.Generic;
public class MyGameServerTarget : TargetRules
{
public MyGameServerTarget(TargetInfo Target)
{
Type = TargetType.Server;
bUsesSteam = true;
}
// TargetRules interface.
public override bool GetSupportedPlatforms(ref List<UnrealTargetPlatform> OutPlatforms)
{
// It is valid for only server platforms
return UnrealBuildTool.UnrealBuildTool.GetAllServerPlatforms(ref OutPlatforms, false);
}
public override void SetupBinaries
(
TargetInfo Target, ref List<UEBuildBinaryConfiguration> OutBuildBinaryConfigurations,
ref List<string> OutExtraModuleNames
)
{
OutExtraModuleNames.Add("MyGame");
}
}
Now as far as I know that is outdated, so I changed it to this:
using UnrealBuildTool;
using System.Collections.Generic;
public class MyGameServerTarget : TargetRules
{
public MyGameServerTarget(TargetInfo Target) : base(Target)
{
Type = TargetType.Server;
bUsesSteam = true;
ExtraModuleNames.AddRange( new string] { "MyGame" } );
}
// TargetRules interface.
public override bool GetSupportedPlatforms(ref List<UnrealTargetPlatform> OutPlatforms)
{
// It is valid for only server platforms
return UnrealBuildTool.UnrealBuildTool.GetAllServerPlatforms(ref OutPlatforms, false);
}
}
However, upon generating the project files, I get the following error:
ERROR: c:\MyProjectPath\MyGame\Source\MyGameServer.Target.cs(22,36) : error CS0122: 'UnrealBuildTool.UnrealBuildTool' is inaccessible due to its protection level
ERROR: c:\MyProjectPath\MyGame\Source\MyGameServer.Target.cs(22,52) : error CS0117: 'UnrealBuildTool.UnrealBuildTool' does not contain a definition for 'GetAllServerPlatforms'
ERROR: UnrealBuildTool Exception: Unable to compile source files.
Does anyone know how to do this correctly?
Thanks!