AwaitLocalUser (Unreal Engine)

- Declaration

static void AwaitLocalUser(FCavrnusSpaceConnection SpaceConnection, CavrnusSpaceUserEvent LocalUserArrived);

Delegates Options:

DECLARE_DYNAMIC_DELEGATE_OneParam(FCavrnusSpaceUserEvent, FCavrnusUser, User);

typedef TFunction<void(const FCavrnusUser&)> CavrnusSpaceUserEvent;

- Description

Triggers LocalUserArrived when the local user becomes present in the given space. Normally there is a delay between first calling JoinSpace and the local user fully connecting/setting up.

If the local user is already present LocalUserArrived will trigger immediately.

- Blueprint Sample

AwaitLocalUser.png
Await Local User

- Code Sample

#include "CavrnusFunctionLibrary.h" #include "Types/CavrnusCallbackTypes.h" void UClassName::Init() { // Members are FCavrnusSpaceConnection SpaceConnection and FCavrnusSpaceUserEvent SpaceUserEvent SpaceUserEvent.BindUFunction(this, GET_FUNCTION_NAME_CHECKED(UClassName, OnLocalUserAdded)); UCavrnusFunctionLibrary::AwaitLocalUser(SpaceConnection, SpaceUserEvent); } void UClassName::OnLocalUserAdded(FCavrnusUser LocalUser) { UE_LOG(LogTemp, Log, TEXT("Local User %s has joined the space - welcome!"), *LocalUser.UserConnetionId); UCavrnusFunctionLibrary::PostFloatPropertyUpdate(SpaceConnection, LocalUser.PropertiesContainerName, "HitPoints", -1000000.0f); // Murder local user on join }