Versions Compared

Key

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

...

If an object is sitting in your Scene ahead of time, you won’t be able to do any Property/Synchronization work with it until you are connected to a Space. A call to AwaitAnySpaceConnection gives you the Space Connection needed to begin the actual work. This also helps avoid the error returned by Cavrnus when trying to update a property without a connection.

Code Block
languagecpp
void APropertySyncActorClass::BeginPlay()
{
  Super::BeginPlay();
  
  // Member is delegate FCavrnusSpaceConnected SpaceConnected;
  SpaceConnected.BindUFunction(this, GET_FUNCTION_NAME_CHECKED(APropertySyncActorClass, OnSpaceConnected));
  
  UCavrnusFunctionLibrary::AwaitAnySpaceConnection(OnSpaceConnected);
}

void APropertySyncActorClass::OnSpaceConnected(FCavrnusSpaceConnection SpaceConnection)
{
  UE_LOG(LogTemp, Log, TEXT("Connected to Space ID %d."), SpaceConnection.SpaceConnectionId);
}

...