I am using the C# library: https://github.com/ubidots/ubidots-c-sharp in Unity 3D.
I am not able to get the current value within a variable. All it returns is the object Ubidots.Variable.
I am able to get names data so I am confident I am connected to Ubidots and that the issue is probably in my code.
Here is my code:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Ubidots;
using Newtonsoft;
using UnityEngine.UI;
public class UbidotsManager : MonoBehaviour {
static ApiClient Api = new ApiClient("XXXXXXXXXXXXXXXXXXXX"); // create Ubidots client
// set up variabels
public Variable exampleVariable;
public Value exampleValues;
public string exampleName;
public Text text;
void Update()
{
exampleVariable = Api.GetVariable("XXXXXXXXXXXX"); // set to the temperature variable
exampleValues = exampleVariable.GetValues()[0]; // get the last value
exampleName = exampleVariable.GetName(); // get the name
Debug.Log(exampleValues); // show me the value
Debug.Log(exampleName); // show me the variable's name
}
}
Here is my resulting log:
Ubidots.Value
UnityEngine.Debug:Log(Object)
UbidotsManager:Update() (at Assets/PID/UbidotsManager.cs:26)
temperature
UnityEngine.Debug:Log(Object)
UbidotsManager:Update() (at Assets/PID/UbidotsManager.cs:27)
p.s. have hidden my API keys with “XXXXXXXXXXXX”