Skip to main content

Setup for iOS

Introduction#

The iOS version of the Antidote SDK is compatible with various Unreal Engine versions:

  • 5.3: supported
  • 5.2: supported
  • 5.1: supported
  • 5.0: supported
  • 4.27: supported
  • 4.26: supported
  • 4.25 and older versions might be supported, but these haven't been officially tested
note

Only C++ projects are currently supported. Blueprint projects are not yet supported.

Setup#

Unreal#

Here's how to integrate the Antidote SDK with your Unreal Engine game on iOS:

  1. Download the latest version of Antidote SDK for Unreal.

  2. If you don't have a Plugins folder yet, create it.

  3. Unzip the downloaded file

  4. Copy the folder AntidoteSDK into your project's Plugins folder. The result will be: /YourProject/Plugins/AntidoteSDK/.

  5. Generate the project Files.

  6. Close the editor.

  7. Recompile the project in Visual Studio.

  8. Add AntidoteSDK as a dependency in your project's build file. Example:

    YourProject.Build.cs
    using UnrealBuildTool;
    public class YourProject : ModuleRules
    {
    public YourProject(ReadOnlyTargetRules Target) : base(Target)
    {
    PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
    PublicDependencyModuleNames.AddRange(new string[] {
    "Core",
    "CoreUObject",
    "Engine",
    "InputCore",
    "HeadMountedDisplay",
    // this line adds AntidoteSDK as a dependency
    "AntidoteSDK",
    // this is required for the watermark
    "UMG"
    });
    }
    }
  9. In your GameMode's BeginPlay, initialize the SDK with the desired options. Example:

    Example: YourProjectGameMode.cpp
    // (...) <-- Other Includes
    #include "Antidote.h"
    #include "AntidoteWatermark.h"
    void YourProjectGameMode::BeginPlay()
    {
    Super::BeginPlay();
    // (...) <-- Some Awesome Configuration
    // Antidote Initialization
    TMap<FString, bool> Options;
    Options.Add(TEXT("validate"), true);
    Options.Add(TEXT("showTouches"), true);
    Options.Add(TEXT("showWatermark"), false);
    UAntidote::Setup(Options);
    UAntidote::Load();
    }
    • validate - verify that the player is authorized to launch the game, and terminate if they aren't
    • showTouches - display user touches on screen
    • showWatermark - enable watermarking
  10. To enable Watermarking, one more step is required.

    1. Add the following to each of your GameMode classes:

      YourProjectGameMode.h
      class AYourProjectGameMode : public AGameModeBase
      {
      GENERATED_BODY()
      public:
      // (...) <-- Some Awesome Existing Code
      TSubclassOf<class UAntidoteWatermark> watermarkClass;
      virtual void BeginPlay() override; // <---
      };
    2. On your GameMode base class add this code:

      YourProjectGameMode.cpp
      // (...) <-- Other Includes
      #include "Antidote.h"
      #include "AntidoteWatermark.h"
      YourProjectGameMode::YourProjectGameMode()
      : Super()
      {
      // (...) <-- Some Awesome Existing Code
      // Find and set the watermarkClass variable
      static ConstructorHelpers::FClassFinder<UAntidoteWatermark> wmClassFinder(TEXT("/AntidoteSDK/BP_Watermark"));
      watermarkClass = wmClassFinder.Class;
      }
      void YourProjectGameMode::BeginPlay()
      {
      Super::BeginPlay();
      // (...) <-- Some Awesome Existing Code
      // Antidote Initialization
      TMap<FString, bool> Options;
      Options.Add(TEXT("validate"), true);
      Options.Add(TEXT("showTouches"), true);
      Options.Add(TEXT("showWatermark"), true);
      UAntidote::Setup(Options);
      // Watermark Initialization
      if (watermarkClass)
      {
      auto watermark = CreateWidget<UAntidoteWatermark>(GetWorld(), watermarkClass);
      watermark->AddToPlayerScreen(9999);
      UAntidote::SetWatermark(watermark);
      TMap<FString, float> Settings;
      Settings.Add(TEXT("textSpeed"), 70.f);
      Settings.Add(TEXT("changePositionSpeed"), 15.f);
      UAntidote::ConfigureWatermark(Settings);
      UAntidote::EnableWatermark(FLinearColor(1.0f, 0.0f, 0.0f, 0.8f));
      UAntidote::ChangeWatermarkBehaviour(UAntidoteWatermark::BehaviourType::TICKER);
      }
      UAntidote::Load();
      }
note

If you have multiple GameModes in your project, you have to add the watermark initialization code to each.

XCode#

If you're using Swift you'll need to configure the following in Xcode:

  1. Drag AntidoteSDK-Bridging-Header.h from the SDK zip to your project
  2. Click on your project in the left pane
  3. Click on Build Settings
  4. scroll down to Swift Compiler - General
  5. Double click on Objective-C Bridging Header
  6. Enter the relative path to AntidoteSDK-Bridging-Header.h

Apple Reviewers#

The Antidote SDK secures your game unauthorised access when players start it directly. When you submit your app to TestFlight, an Apple reviewer will need to be able to access your game without using the Antidote app. To do this, you will need to add login credentials to your TestFlight submission.

You can generate these login credentials by logging into your account at app.antidote.gg:

  1. Click on Games.
  2. Click on your iOS game.
Game view
  1. Click on Security.
  2. If this is the first time you are configuring credentials on your game you will see the following:
Game security view
  1. Click on Renew Credentials and follow the prompts.
Game security credentials view
caution

Save the password somewhere secure as it will not be shown again once the modal is closed. If you do forget the password, you can generate new credentials on this view.

Tips & Troubleshooting#

How to create a GameMode Class#

  1. Go to Unreal Editor.
  2. Click File/New C++ Class.
  3. Scroll down, select GameMode (Base class of the heads-up display).
  4. Click Next.
  5. Set a Name (e.g YourProjectGameMode).
  6. Click Create Class.
  7. Go to ProjectSettings/Maps & Modes.
  8. Set GameMode to your custom GameMode.

I can't see touches in my game#

Displaying touches is not currently supported on iOS due to incompatibility with the Metal framework.

Unreal Editor doesn't start or shows an error regarding a plugin is not found#

  1. Close Unreal Editor.
  2. Open the project in Xcode.
  3. Clean Build.
  4. Rebuild.
  5. Open the project in Unreal Editor again.