AwaitAnySpaceConnection (Unreal Engine)

- Declaration

static void AwaitAnySpaceConnection(CavrnusSpaceConnected OnConnected);

Delegates Options:

DECLARE_DYNAMIC_DELEGATE_OneParam(FCavrnusSpaceConnected, FCavrnusSpaceConnection, SpaceConnection);

typedef TFunction<void(const FCavrnusSpaceConnection&)> CavrnusSpaceConnected;

- Description

Triggers immediately if you are already in a space, otherwise triggers as soon as you connect

- Blueprint Sample

 

AnySpaceConnection.png
Await Any Space Connection

- Code Sample

HudClass.h

#pragma once #include "CoreMinimal.h" #include "Types/CavrnusCallbackTypes.h" #include "Blueprint/UserWidget.h" #include "HudClass.generated.h" UCLASS() class MODULE_API UHudClass: public UUserWidget { GENERATED_BODY() public: void NativeConstruct(); private: void OnSpaceConnected(FCavrnusSpaceConnection SpaceConnection); FCavrnusSpaceConnected SpaceConnected; };

HudClass.cpp

#include "HudClass.h" #include "CavrnusFunctionLibrary.h" USpaceListWidget::NativeConstruct() { Super::NativeConstruct(); SpaceConnected.BindUFunction(this, GET_FUNCTION_NAME_CHECKED(UHudClass, OnSpaceConnected)); UCavrnusFunctionLibrary::AwaitAnySpaceConnection(OnSpaceConnected); } void USpaceListWidget::OnSpaceConnected(FCavrnusSpaceConnection SpaceConnection) { UE_LOG(LogTemp, Log, TEXT("Connected to Space ID %d."), *SpaceConnection.SpaceConnectionId); // Now probably want to fetch the user list, turn on RTC HUD elements, etc. }

Related pages