Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

- Sample

Code Block
languagec#
using CavrnusSdk.API;
using UnityEngine;

public class ManageObjectColor : MonoBehaviour
{
    public Material MyMaterial;

    private const string ContainerName = "MyMaterial";
    private const string PropertyName = "color";

    private CavrnusSpaceConnection spaceConn;

    private void Start()
    {
        CavrnusFunctionLibrary.AwaitAnySpaceConnection(spaceConn => OnConnectedToSpace(spaceConn));
    }

    private void OnConnectedToSpace(CavrnusSpaceConnection spaceConn)
    {
        this.spaceConn = spaceConn;

        spaceConn.DefineColorPropertyDefaultValue(ContainerName, PropertyName, MyMaterial.color);

        spaceConn.BindColorPropertyValue(ContainerName, PropertyName, c => MyMaterial.color = c);
    }
}//Coming Soon