using CavrnusSdk.API;
using UnityEngine;
public class ExampleScript: MonoBehaviour
{
public void Start()
{
CavrnusFunctionLibrary.AwaitAnySpaceConnection(sc => {
sc.AwaitLocalUser(lu => {
lu.BindToLocalUserMetadataJson("newJson", val => {
var formattedJson = val?.ToString(Newtonsoft.Json.Formatting.Indented);
print($"Json Val: {formattedJson}");
if (val == null)
return;
var r = val["r"].Value<float>();
var g = val["g"].Value<float>();
var b = val["b"].Value<float>();
var a = val["a"].Value<float>();
var receivedColor = new Color(r, g, b, a);
// Output the received color
Debug.Log($"Received Color: {receivedColor}");
});
});
});
}
} |