# Unreal Engine 4

## 1. Creating a UE4 Project

1-1. In the window shown below, which appears immediately after launching the UE4 Editor, select '<mark style="color:orange;">Game'</mark>, which is circled in red in the screenshot, and when the '<mark style="color:orange;">Open Project</mark>' button changes to '<mark style="color:orange;">Next'</mark>, press the '<mark style="color:orange;">Next</mark>' button.<br>

<figure><img src="https://content.gitbook.com/content/Ceg6wWD81CFYby05yPX5/blobs/6sK0LoMGYYeCAc1xWTlN/unreal_1.png" alt=""><figcaption></figcaption></figure>

#### 1-2.  In the '<mark style="color:orange;">Choose a template</mark>' window, select '<mark style="color:orange;">Default</mark>' and press '<mark style="color:orange;">Next</mark>'.

<figure><img src="https://content.gitbook.com/content/Ceg6wWD81CFYby05yPX5/blobs/OWheW84Da8IcLHwNnra1/unreal_2.png" alt=""><figcaption></figcaption></figure>

#### 1-3. In the '<mark style="color:orange;">Project Settings</mark>' window, press the '<mark style="color:orange;">Blueprint</mark>' button, which will expand to a drop-down list of buttons.

<figure><img src="https://content.gitbook.com/content/Ceg6wWD81CFYby05yPX5/blobs/G51FOKbdhM9R3wbGqSlD/unreal_3.png" alt=""><figcaption></figcaption></figure>

#### 1-4. From the expanded drop-down list, select C++ as shown in the screenshot below.

<figure><img src="https://content.gitbook.com/content/Ceg6wWD81CFYby05yPX5/blobs/uflRpEdqj7ORu8hSmuXL/unreal_4.png" alt=""><figcaption></figcaption></figure>

#### 1-5. Enter the path to create the project and the project name in the '<mark style="color:orange;">Project path window</mark>' and '<mark style="color:orange;">Project name window</mark>', which are marked with red boxes in the screenshot below, and click '<mark style="color:orange;">Create project</mark>'.

<figure><img src="https://content.gitbook.com/content/Ceg6wWD81CFYby05yPX5/blobs/CBqHMbwstO0jz4sQVJC0/unreal_5.png" alt=""><figcaption></figcaption></figure>

#### 1-6. When you finish creating the project, the Visual Studio IDE and UE4 Editor will be launched simultaneously with the created project.

#### 1-7. In the Visual Studio IDE, be sure to specify the Configuration and Platform as shown below.

{% hint style="info" %}

* Solution Configuration : <mark style="color:orange;">Development Editor</mark>
* Solution Platform : <mark style="color:orange;">Win64</mark>
  {% endhint %}

## 2. Integrating ProudNet into your UE4 project

Specify the ProudNet library and header file paths in C# code in the <mark style="color:orange;">(project name).build.cs</mark> file.

> 1. Open the cs file and there will be a class with the same project name automatically generated by UE4 Editor. The class is currently held only by the creator.
> 2. If you look at the creator's body, you can see a few lines of annotation at the back. Put the code behind the annotation specifying the reference path to the ProudNet library and header file.
> 3. To specify the ProudNet library reference path, pass the library path string to the Add function of the <mark style="color:orange;">PublicAdditionalLibraries</mark> object.\
>    E.g.: **> PublicAdditionalLibraries.Add("D:\ProudNet1.7.48971-master\ProudNet\lib\x64\v140\Release\ProudNetClient.lib")**
> 4. To specify the ProudNet header file reference path, pass the path to the ProudNet include folder to the Add function of the global object called <mark style="color:orange;">PublicIncludepaths</mark>.\
>    E.g.: **> PublicIncludePaths.Add("D:\ProudNet1.7.48971-master\ProudNet)**
> 5. UE4 projects that integrate with ProudNet must be built in 64-bit, so enclose the two previous sentences in curly braces and add an if statement above them.
> 6. The lib files required for IOS and Android builds are also enclosed in an if statement.

Below is an example with commenting removed.

{% code overflow="wrap" lineNumbers="true" fullWidth="false" %}

```cpp
// Copyright Epic Games, Inc. All Rights Reserved.
 
using System.IO;
using UnrealBuildTool;
 
public class TestUnreal4 : ModuleRules
{
    public TestUnreal4(ReadOnlyTargetRules Target) : base(Target)
    {
        PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
    
        PublicIncludePaths.AddRange(
	new string[] {
	    // ... add public include paths required here ...
	}
	);
				
		
	PrivateIncludePaths.AddRange(
	new string[] {
	    // ... add other private include paths required here ...
	}
	);
 
        if (Target.Platform == UnrealTargetPlatform.Win64)
        {
            // Add the import library
            PublicAdditionalLibraries.Add(@"D:\ProudNet1.8.00002-master\ProudNet\lib\x64\v140\Release\ProudNetClient.lib");
        }
        else if (Target.Platform == UnrealTargetPlatform.IOS)
        {
            PublicAdditionalLibraries.Add(@"D:\ProudNet1.8.00002-master\ProudNet\lib\x64\v140\Release\libProudNetClient.a");
            
            PublicAdditionalLibraries.Add(@"D:\ProudNet1.8.00002-master\ProudNet\lib\x64\v140\Release\libiconv.2.tbd"));
        }
        else if(Target.Platform == UnrealTargetPlatform.Android)
        {
        PublicAdditionalLibraries.Add(@"D:\ProudNet1.8.00002-master\ProudNet\lib\NDK\r20\cmake\clangRelease\arm64-v8a\libProudNetClient.a);
        }
        
         PublicIncludePaths.Add(@"D:\ProudNet1.7.48971-master\ProudNet\include");
    }
}
```

{% endcode %}

{% hint style="warning" %}
For iOS and Android, please refer to <mark style="color:orange;">ProudNet\lib\NDK\r20\cmake\clangDebug\arm64-v8a\libProudNetClient.a</mark> instead of <mark style="color:orange;">ProudNet\lib\x64\v140\Release\libProudNetClient.lib</mark>.
{% endhint %}

{% hint style="danger" %}
Please do not set it to the path in the example code above, but to the path where your actual Proudnet is installed.
{% endhint %}

<figure><img src="https://content.gitbook.com/content/Ceg6wWD81CFYby05yPX5/blobs/heUBBbNiy2CkuRTxcx9c/ue_ProudNet.png" alt=""><figcaption></figcaption></figure>

As in the example above, you can create a <mark style="color:orange;">CNetClient</mark> normally without any compilation errors.

## 3. Android Build

Please refer to the link below.

{% hint style="success" %}
**Reference**

[**Quick Start for Android**](https://docs.unrealengine.com/5.3/ko/setting-up-unreal-engine-projects-for-android-development/)
{% endhint %}

## 4. iOS Build

{% hint style="warning" %}
You must additionally specify the path to the <mark style="color:orange;">libiconv.2.tbd</mark> library.

If you do not specify it, you will get iconv-related linking errors at build time.
{% endhint %}

<figure><img src="https://content.gitbook.com/content/Ceg6wWD81CFYby05yPX5/blobs/XGwkMZhSsNfmaPTNkZRX/libiconv.png" alt=""><figcaption></figcaption></figure>

Please refer to the link below.

{% hint style="success" %}
**Reference**

[**Quick Start for iOS**](https://docs.unrealengine.com/5.3/ko/setting-up-an-unreal-engine-project-for-ios/)
{% endhint %}
