Skip to content

Latest commit

 

History

History
91 lines (66 loc) · 2.67 KB

README.md

File metadata and controls

91 lines (66 loc) · 2.67 KB

Unreal Engine integration

Our C-core SDK can be used together with Unreal Engine. It's not a fully functional plugin yet, but can easily be integrated into your project as a Unreal Engine Module.

How to setup PubNub C-Core SDK as a Unreal Engine Module

  1. Clone this repository to the <UnrealProject>/Source/ directory. We recommend that you place it inside the ThirdParty folder (create it, if necessary).

  2. Compile the desired option of the SDK. You can do it in the SDK directory like so:

cmake . && make

C-core offers some customization flags (e.g. shared library or using openssl). You can configure that as follow:

cmake . -DSHARED=ON -DOPENSSL=ON -DOPENSSL_ROOT_DIR={unreal engine location}/Engine/Source/ThirdParty/openssl/1.1.1x/ -DCUSTOM_OPENSSL_LIB_DIR=lib/XXX/ -DCUSTOM_OPENSSL_INCLUDE_DIR=include/XXX/

where x is UE's version and XXX is your desired architecture.

  1. Adjust PubNubModule/PubNubModule.Build.cs with selected options by changing OpenSsl, StaticLink and BuildLocation with the same values you used for compilation.

For example:

  private bool OpenSsl = true;
  private bool StaticLink = false;
  private string BuildLocation = "build/";
  1. Finally, import the module into your project as follows:
  • <UnrealProject>.Target.cs and <UnrealProject>Editor.Target.cs

    public class <UnrealProject>[Editor]Target : TargetRules
    {
      public <UnrealProject>[Editor]Target (TargetInfo Target) : base(Target)
      {
        //...
        ExtraModuleNames.Add("PubNubModule");
      }
    }
  • <UnrealProject>.uproject

    {
      //...
      "Modules": [
        //...
        {
          "Name": "PubNubModule",
          "Type": "Runtime",
          "LoadingPhase": "Default"
        }
      ],
      //...
    }

Generate the project files using your IDE of choice and you are ready to go!

Usage

  1. Make PubNub discoverable in the module you want to use PubNub in by modifying the <Module>.Build.cs file:
public class <Module> : ModuleRules
{
  public <Module>(ReadOnlyTargetRules Target) : base(Target)
  {
    //...
    PrivateDependencyModuleNames.Add("PubNubModule");
  }
}
  1. Import the PubNub.h header into your files as follows:
#include "PubNub.h" 

Note that you don't have to wrap it with THIRD_PARTY_INCLUDES_START and THIRD_PARTY_INCLUDES_END because we've done that for you.

Good luck with your project!