Versions Compared

Key

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

...

Info

JoinSpace() can also be used to provide a SpaceConnectionConfig, it is simply an optional parameter. If it’s not provided, the default empty string will be used as the tag.

Using JoinSpaceWithOptions

In this example, providing a Tag now marks the subsequent

Code Block
languagec#
  public void SpaceSelected(CavrnusSpaceInfo spaceInfo)
  {
      var config = new CavrnusSpaceConnectionConfig {Tag = "CustomTag"};
      CavrnusFunctionLibrary.JoinSpaceWithOptions(spaceInfo.Id, config, print, print);
  }

Connecting to Multiple Spaces Example

By utilizing multiple JoinSpaceWithOptions() along with corresponding AwaitSpaceConnectionByTag calls, multiple space connections will be created and independently handled allowing for multiple spaces to coexist simultaneously.

Code Block
languagec#
  public void Start()
  {
      CavrnusFunctionLibrary.AwaitAuthentication(auth => {
          var configA = new CavrnusSpaceConnectionConfig {Tag = "A"};
          CavrnusFunctionLibrary.JoinSpaceWithOptions("Space-A", configA, print, print);
          
          var configB = new CavrnusSpaceConnectionConfig {Tag = "B"};
          CavrnusFunctionLibrary.JoinSpaceWithOptions("Space-B", configB, print, print);
      });
      
      CavrnusFunctionLibrary.AwaitSpaceConnectionByTag("A", spaceConnection => {
          print("Space A is now connected!");
      });
      
      CavrnusFunctionLibrary.AwaitSpaceConnectionByTag("B", spaceConnection => {
          print("Space B is now connected!");
      });
    }
  }

Using Default Tag

Code Block
languagec#
  public void SpaceSelected(CavrnusSpaceInfo spaceInfo)
  {
      var config =
new CavrnusSpaceConnectionConfig {Tag = ""};
      CavrnusFunctionLibrary.JoinSpaceWithOptions(spaceInfo.Id, config, print, print);
  }