This repository has been archived by the owner on Jul 16, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 23
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.
- Download the Beam SDK from the Unity Asset Store
- 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
- If the import process is successful, a Beam folder is created under Assets folder in your Unity project
- Go to Beam > Prefabs, and drag the BeamManager prefab into your scene. We recommend making it as your first element in the scene
- Open the Beam menu and select Interactive Studio
- Create a new project and name it "HelloWorld". Then click Save
- Click the Build tab at the top of the Interactive Studio Editor as shown in the screenshot below
- Add a new scene called "default".
- 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
- Drop the button on the grid
- Click Save
- Go to the Code tab at the top of the Interactive Studio Editor
- Copy the Project Version ID to your clipboard
- Open the Beam menu and select Open Beam Editor
- Paste the Version ID from step 8 into the Version ID field in the Beam Editor
- Click the following link from the Code tab to go to the Developer Lab
- Click the Manage OAuth button to enter the OAuth Clients page
- Create a new OAuth client with the following information:
- Name: MyOAuthClient
- Website: http://beam.pro
- Hosts: *.beam.pro
- Next, go to Unity and copy and past the OAuth Client ID into the OAuth Client ID field in the Beam Editor
- Click the Save project information button
- Create a new GameObject in the hierarchy window
- Create a new script and name it HelloBeam.cs
- 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.
- 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.");
}
}
- To test your set up, click on the Play button in the Unity editor
- Follow the instructions and enter the displayed code at http://beam.pro/go
- Open a web browser and go to your Beam channel: http://beam.pro/
- Click on the Give Health button
- If you have the Unity console open, you'll see "Player health increased." printed on the console