[UE4]如何集成RakNet

 

原文:

Is it possible to compile RakNet using UE4?

https://answers.unrealengine.com/questions/158112/is-it-possible-to-compile-raknet-using-ue4.html

 

Steps to add RakNet (release) to UE4:

 

1,Download RakNet.

 

2,Copy "RakNet-master" folder to "UE4/Engine/Source/ThirdParty/RakNet/".

 

3,Create there "RakNet.Build.cs"

using UnrealBuildTool;
 
public class RakNet : ModuleRules
{
	public RakNet(TargetInfo Target)
	{
		Type = ModuleType.External;

		if (Target.Platform == UnrealTargetPlatform.Win64)
		{
			PublicIncludePaths.Add(UEBuildConfiguration.UEThirdPartySourceDirectory + "RakNet/RakNet-master/Source/");
			PublicLibraryPaths.Add(UEBuildConfiguration.UEThirdPartySourceDirectory + "RakNet/RakNet-master/Lib/");
			PublicAdditionalLibraries.Add("RakNet_vs2008_libstatic_release_x64.lib");
		}
	}
}

4,Open RakNet_VS2008.sln with VS2013. Conversion will be automatically fine.

 

5,Set build mode "Release" / "x64".

 

6,Change "LibStatic" project properties: C/C++/CodeGeneration/Runtime Library = Multi-threaded DLL (taken from https://wiki.unrealengine.com/Linking_Static_Libraries_Using_The_Build_System)

 

7,Build "LibStatic".

 

8,Add to your "Project.Build.cs" following:

PrivateDependencyModuleNames.Add("RakNet");

 需要添加的头文件:

#include "AllowWindowsPlatformTypes.h" // UE4

#include "RakPeerInterface.h"
#include "MessageIdentifiers.h"
#include "BitStream.h"
#include "RakNetTypes.h"
#include "Rand.h"

#include "HideWindowsPlatformTypes.h" // UE4
 

猜你喜欢

转载自aigo.iteye.com/blog/2287321
UE4