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

Getting started

Joanna Lee edited this page May 3, 2017 · 40 revisions

This article explains how to create a Beam interactive game project in Unity. A Beam Interactive game enables viewers to directly control the environment in and around streamers' broadcasts by interacting with the UI controls displayed.

  1. Download the Beam SDK from the Unity Asset Store
  2. To import the Beam SDK, open the Unity Editor and select: Assets > Import Package > Custom Package. Locate your downloaded SDK package, select the package, and click Open. Leave all the files checked and click Import as shown in the screenshot below

  1. If the import process is successful, a Beam folder is created under Assets folder in your Unity project
  2. Go to Beam > Prefabs, and drag the BeamManager prefab into your scene. We recommend making it as your first element in the scene

  1. Open the Beam menu and select Interactive 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 scene called "default".
  2. 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 the game code

  1. Drop the button on the grid
  2. Click Save
  3. Go to the Code tab at the top of the Interactive Studio Editor

  1. Copy the Project Version ID to your clipboard
  2. Open the Beam menu and select Open Beam Editor
  3. Paste the Version ID from step 8 into the Version ID field in the Beam Editor
  4. Click the following link from the Code tab to go to the Developer Lab

  1. Click the Manage OAuth button to enter the OAuth Clients page
  2. Create a new OAuth client with the following information:
  1. Next, go to Unity and copy and past the OAuth Client ID into the OAuth Client ID field in the Beam Editor
  2. Click the Save project information button
  3. Create a new GameObject in the hierarchy window
  4. Create a new script and name it HelloBeam.cs
  5. Open the HelloBeam.cs script and add the following call to Beam.GoInteractive() to the Start function
void Start() {
    Beam.GoInteractive();
}

Beam.GoInteractive() is the API method to connect to the Beam service.

  1. Within the script's Update method, add a call to receive input from the button you've created in step 8
void Update() {
   if (Beam.GetButton("GiveHealth")) {
       Debug.Log("Player health increased.");
   }
}
  1. To test your set up, click on the Play button in the Unity editor
  2. Follow the instructions and enter the displayed code at http://beam.pro/go
  3. Open a web browser and go to your Beam channel: http://beam.pro/
  4. Click on the Give Health button
  5. If you have the Unity console open, you'll see "Player health increased." printed on the console
Clone this wiki locally