Menu

BLYNC SDK

Blync SDK DOWNLOAD

I have read and agree to the License

Blync SDK

Use Blync SDK to develop your Blync compatible app. The SDK is a Unity package that you can import in your unity project. The SDK imports inside your Plugins folder and has an example scene that shows how to get started in using it with your project.


blync

Using Blync SDK

Follow the below steps to get started using Blync SDK for your unity project.

  1. Download: Download the sdk from this page and extract the zip file.
  2. Import to your unity project: In your unity project Asset folder, right click and import the BlyncSDK package from where you extracted it. This will import all the contents of the sdk to Blync folder inside your Plugins folder
  3. Get App and Scene Id: To start developing an app, you will need an app Id and a scene Id. To get one, go to your Blync Companion app for your Windows or Mac computer and select Create menu. In the Create panel, click on Create App button. Specify the App name and description and click Create App button. This will create an app for you and will give you an App Id. Inside the created app, click on Scenes button to view scenes of the app. On the scenes page, click Add Scene button and specify a name to create a scene. This will add the scene with a Scene Id. On the newly created scene, click on Add Asset button. This will take you to a browser page where you need to upload an image for the scene.
  4. Set App and Scene Id for your project: Once you have your App Id and Scene Id from above step, go back to your SDK folder under Plugins/Blync/Models/Server/. You will see BlyncSceneIdentity object. Select it and in the inspector paste the App Id and Scene Id you got from your companion app.
  5. BlyncController Prefab: BlyncController prefab takes care of connecting your game to Blync device and managing sensor data from Blync sensors. Drag the BlyncController prefab from the Prefab folder of the sdk inside your scene hierarchy. It should be disabled by default. Any point in your game you wish to connect to Blync device, enable the gameObject. Once you have BlyncController in your scene, select it and in the inspector, drag your maincamera object to the Main Camera reference of BlyncController. This is needed to position the UI during connection.
  6. Game Logic: Have your game logic to reference BlyncController Gameobject. Your game logic will also need a reference to BlyncControllerData Scriptable Object which will be used to receive an event once Blync connects to your app. First call RegisterBlyncConnectedListener and pass in a callback function that will be called on connection success. Then SetActive BlyncController Gameobject to start connection process with Blync. Once the connection is successful, call ChangeSession(true) on BlyncControllerData to enable biking session and start sending sensor reading to your app
  7. Sensor Readings: The sensor data can be read from SensorSpeed and TurnAngle Scriptable Objects. They are both of Type FloatVariable. You will need both references on your bike and read their public float value paramter to get the current sensor values.
Scriptable Objects
BlyncControllerData (Plugins/Blync/Models/Sensor): Use this object to receive events and start biking sessions. The available members are;
  1. void RegisterBlyncConnectedListener(Action<bool> callback) You need to call this function before enabling the BlyncController prefab. The callback paramter will be called once the Blync device connects to your app. It will be called with a value of true. If it disconnects, the callback will be called with a value of false.
  2. void ChangeSession(bool value) Once your Blync device connects. You will need to start a session by calling ChangeSession and passing true. A session represents a round of your game. Biking statistics are recorded for the user during a session. Once the round ends, call the ChangeSession again and pass false as paramter to end the session and save the statistics. The movement sensor data is paused once the session in not active.
  3. bool isSessionStarted() This returns if the sesssion is active or not
  4. void disconnect() This disconnects the Blync device from the app
  5. void setCenterCorrection() This is used to re-align the user's physical handlebar with their avatar handlebar. When called, it uses the current position of the physical handlebar as the center for the game handlebar
  6. void resetCenterCorrection() This resets any previously set data for the user's handlebar center.
SensorSpeed (Plugins/Blync/Models/Sensor): This gives the approximate speed reading (m/s) of the bike. It has a public float value that has the current speed value of the sensor. The Type of the object is FloatVariable.

TurnAngle (Plugins/Blync/Models/Sensor): This gives the turn angle of the bike. The range of angle for the angles are set in BlyncController prefab with default range of -180 to 180. With a value of 0, it means the handlebar is straight. With a negative or positive value, it means the handlebar is turning left or right. The Type of the object is FloatVariable.

BlyncUserData (Plugins/Blync/Models/Server): BlyncUserData gives you the Blync profile data of the current user. The available members are;
  1. string username() This returns the username of the Blync user
  2. string userId() This returns the user id of the user
  3. string lang() This returns the language settings of the user. e.g (en, es, de, jp, fr, cn)
BlyncSceneIdentity (Plugins/Blync/Models/Server): BlyncSceneIdentity is used to set the App Id and Scene Id of your game. The scene Id can be changed to a new scene Id before enabling session.