Skip to content
This repository has been archived by the owner on Jul 16, 2020. It is now read-only.

Getting started using C Plus Plus

Gersh Payzer edited this page Jun 7, 2018 · 19 revisions

These instructions are written assuming you are building the Unreal Engine from source. If you aren't, don't worry, start with the steps at Working with a pre-built version of Unreal Engine and then pick up these instructions at Create an interactive project.

Build the plugin

  1. Enlist in this repo.
  2. Go to your enlistment copy the root folder (interactive-unreal-plugin) into \Engine\Plugins\Runtime.
  3. Go to the root of your Unreal enlistment and run the script: GenerateProjectFiles.bat. This will add the Mixer plugin to the Unreal solution.
  4. Open the UE4.sln and press F5 to build the Mixer plugin and run the Unreal Editor.

Create an interactive project

  1. Go to Interactive Studio (https://mixer.com/i/studio).
  2. Create a new project and name it "HelloWorld". Then click Save.

  1. Click the Build tab at the top of the Interactive Studio Editor as shown in the screenshot below:

  1. Add a new control. Make sure the control type is set to button (this is the default). Name the button "giveHealth". This is the string is referenced in your Unreal Blueprints or game code.
  2. Enter "Give Health" as the text property for the button.

  1. Drop the button on the grid.
  2. Click Save.

Linking your interactive project to Unreal

  1. In the Unreal Editor, go to Edit > Plugins to open the Project Settings window.
  2. In the left pane, go to Installed > Misc and select Mixer.
  3. Check the Enabled checkbox, then click the Restart now button to restart the Unreal editor.

  1. Open a web browser and go to Mixer's Interactive Studio to create an OAuth client.
  2. Click the Create new client button to create a new OAuth client.

  1. Fill out the form with these values:
  1. Press Create to create the client.

  1. Go back to the Unreal editor and go to Edit > Project Settings... to open the Project Settings window.
  2. In the left pane, scroll down to the Plugins section and select Mixer Interactivity.
  3. Copy the Client ID of the OAuth client we just created and paste it in the Client ID field.
  4. Type http://www.mixer.com in Redirect Uri field.

  1. Click the Login button.
  2. Follow the instructions in the log in dialog to log in to Mixer.
  3. Select your interactive project from the Game Name dropdown.
  4. Select your Game Version Id from the dropdown.
  5. Press the Save local... button. This will make Unreal's Blueprint system aware of the controls in your interactive project.

Logging in to Mixer

  1. Go to File > New C++ Class... to open the C++ class Wizard. Name it "MyModule".
  2. Select Actor as the parent class. Name it "MyActor". Click Next.
  3. Go to Visual Studio and under your game's project in the folder \Source<project name>, you will see a file called ".Build.cs". Open that file.
  4. Add "MixerInteractivity"to the list of public include path modules. This will help Unreal find the header files for the Mixer SDK.
    PublicIncludePathModuleNames.Add("MixerInteractivity");
  1. Next, go to MyActor.h and add the following includes right above MyActor.generated.h:
#include <MixerInteractivityModule.h>
#include <MixerInteractivityTypes.h>
#include "MyActor.generated.h"
  1. Next, we will add the code to log in. First go to MyActor.h, and add a function declaration for a login state changed handler:
    void OnLoginStateChanged(EMixerLoginState state);
  1. In MyActor.cpp, add a the following function. This function will wait until login has completed and then call the StartInteractivity method to show the interactive controls on the Mixer channel:
void AMyPawn::OnLoginStateChanged(EMixerLoginState newState)
{
    if (newState == EMixerLoginState::Logged_In)
    {
        IMixerInteractivityModule::Get().StartInteractivity();
    }
}
  1. In MyActor.cpp, add the following code to the AMyActor::BeginPlay method. This will authenticate with the Mixer service. From the previous step, when login completes, the OnLoginStateChanged handler will get called and start interactivity.
    FDelegateHandle LoginStateDelegateHandle = IMixerInteractivityModule::Get().OnLoginStateChanged().AddUObject(this, &AMyPawn::OnLoginStateChanged);
    IMixerInteractivityModule::Get().LoginSilently();
  1. Close the unreal editor and build your project. Note: This step is not necessary if you are not building Unreal from source.
  2. When the editor launches, drag your pawn into the scene and press Play.
  3. Press Shift+F1 to see the mouse.
  4. Open a browser and navigate to your channel page (https://www.mixer.com/) and you will see your "Give Health" button control.

Note: these instructions rely on running the Unreal Editor using Mixer credentials established earlier. For help on getting started with Mixer login at runtime see this page.

Additional common next steps

If you are shipping an Xbox One game, we encourage you to take the following steps.

Share Codes

If you want to share a build of your game with others. For example, you want to give a demo of your Mixer integration to a publisher, we recommend using share codes. Learn how to use share codes here

Test streams

If you are shipping your game on Xbox One and want to test your Mixer integration without others seeing your game, you can use the test streams feature. To get access to Test Streams, send an email with to [email protected] with the following information:

  • Your Xbox Live sandbox
  • The mixer channel names of the accounts you will be broadcasting from

Once you have access, you can read more about the feature here.

Mixer and Xbox One

If you are shipping a game for Xbox One and doing Mixer, we strongly encourage you to read the Mixer and Xbox Live article. It covers common questions developers run into when trying to develop Mixer integration for an Xbox One game.