PostXPropertyUpdate (Unity)

- Declaration

public static void PostColorPropertyUpdate(this CavrnusSpaceConnection spaceConn, string containerName, string propertyName, Color propertyValue)

public static void PostFloatPropertyUpdate(this CavrnusSpaceConnection spaceConn, string containerName, string propertyName, float propertyValue)

public static void PostBoolPropertyUpdate(this CavrnusSpaceConnection spaceConn, string containerName, string propertyName, bool propertyValue)

public static void PostStringPropertyUpdate(this CavrnusSpaceConnection spaceConn, string containerName, string propertyName, string propertyValue)

public static void PostVectorPropertyUpdate(this CavrnusSpaceConnection spaceConn, string containerName, string propertyName, Vector4 propertyValue)

public static void PostTransformPropertyUpdate(this CavrnusSpaceConnection spaceConn, string containerName, string propertyName, CavrnusTransformData propertyValue)

-public static void PostTransformPropertyUpdate(this CavrnusSpaceConnection spaceConn, string containerName, string propertyName, Vector3 pos, Vector3 rot, Vector3 scl)

-public static void PostTransformPropertyUpdate(this CavrnusSpaceConnection spaceConn, string containerName, string propertyName, Transform transform)

- Description

Updates the property value at the given path and synchronizes the data to the server.

This is the most common/simple way of changing a property’s value. However, since it writes to the journal, it is best to not post hundreds or thousands of these changes in rapid succession. Instead when, for example, dragging an object between two points, consider using BeginTransientXPropertyUpdate instead.

- Sample

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 => this.spaceConn = spaceConn); } public void SetToNewColor(Color newColor) { spaceConn.PostColorPropertyUpdate(ContainerName, PropertyName, newColor); } }

Related pages