/
BindToLocalUserMetadataJson (Unity)
BindToLocalUserMetadataJson (Unity)
public static IDisposable BindToLocalUserMetadataJson(this CavrnusUser user, string key, Action<JObject> onMetadataChanged)
- Description
Binds local user JSON metadata via key-value lookup where key is. Triggers when the metadata value updates.
For more information on user metadata, see INSERTPAGE for details.
- Sample
using CavrnusSdk.API;
using UnityEngine;
public class ExampleScript: MonoBehaviour
{
public void Start()
{
CavrnusFunctionLibrary.AwaitAnySpaceConnection(sc => {
sc.AwaitLocalUser(lu => {
lu.BindToLocalUserMetadataJson("newJson", val => {
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}");
});
});
});
}
}
, multiple selections available,
Related content
UpdateLocalUserMetadataJson (Unity)
UpdateLocalUserMetadataJson (Unity)
More like this
BindToLocalUserMetadataString (Unity)
BindToLocalUserMetadataString (Unity)
More like this
UpdateLocalUserMetadataString (Unity)
UpdateLocalUserMetadataString (Unity)
More like this
FetchLocalUserMetadata (Unity)
FetchLocalUserMetadata (Unity)
More like this
BindXPropertyValue (Unity)
BindXPropertyValue (Unity)
More like this
GetXPropertyValue (Unity)
GetXPropertyValue (Unity)
More like this