Skip to content

Instantly share code, notes, and snippets.

@bitchwhocodes
Created July 24, 2014 22:05
Show Gist options
  • Save bitchwhocodes/e71c1f18d159e9ba23c0 to your computer and use it in GitHub Desktop.
Save bitchwhocodes/e71c1f18d159e9ba23c0 to your computer and use it in GitHub Desktop.
SpacebrewEvents.cs
using UnityEngine;
using System.Collections;
public class SpacebrewEvents : MonoBehaviour {
SpacebrewClient sbClient;
// Use this for initialization
void Start () {
GameObject go = GameObject.Find ("SpacebrewObject"); // the name of your client object
sbClient = go.GetComponent <SpacebrewClient> ();
// register an event with the client and a callback function here.
// COMMON GOTCHA: THIS MUST MATCH THE NAME VALUE YOU TYPED IN THE EDITOR!!
sbClient.addEventListener(this.gameObject, "button_pressed");
}
public void OnSpacebrewEvent(SpacebrewClient.SpacebrewMessage _msg) {
GameObject.Find("subscribeText").guiText.text = _msg.value;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment