Skip to content
This repository was 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. In the Import Unity Package dialog, click Import.

  1. This creates a Beam folder in your Unity project.
  2. Go to Beam > Prefabs, and drag the BeamManager prefab into your scene.

We recommend making it the first element in your 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.

  1. Add a new scene called "default". Next, add a new control. Make sure the control type is set to button (this is the default). Use the name "GiveHealth". This is the string you will reference in your game code.

  1. Drop the button on the grid.
  2. Click Save.
  3. Go to the Code tab.

  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 called HelloBeam.cs.
  5. Open the 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. 23. 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. 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