Unreal
ViveportUserDemo.h
#include "Components/ActorComponent.h"
#include "ViveportApi.h"
#include "ViveportUser.h"
#include "ViveportType.h"
#include "ViveportUserDemo.generated.h"
UCLASS(ClassGroup = (Viveport), meta = (BlueprintSpawnableComponent))
class VIVEPORTSDK_API UViveportUserDemo : public UActorComponent
{
GENERATED_BODY()
public:
// Sets default values for this component's properties
UViveportUserDemo();
// Called when the game starts
void BeginPlay() override;
// Called every frame
void TickComponent(
float DeltaTime,
ELevelTick TickType,
FActorComponentTickFunction* ThisTickFunction
) override;
};
ViveportUserDemo.cpp
#include "ViveportSDKPrivatePCH.h"
#include "ViveportUserDemo.h"
// Sets default values for this component's properties
UViveportUserDemo::UViveportUserDemo()
{
// Set this component to be initialized when the game starts, and to be ticked every frame. You can turn these features
// off to improve performance if you don't need them.
bWantsBeginPlay = true;
PrimaryComponentTick.bCanEverTick = true;
}
// Called when the game starts
void UViveportUserDemo::BeginPlay()
{
Super::BeginPlay();
const FString fstring = FString::Printf(TEXT("GetUserID=%s\nGetUserName=%s\nGetUserAvatarUrl=%s"),
*UViveportUser::GetUserID(),
*UViveportUser::GetUserName(),
*UViveportUser::GetUserAvatarUrl());
GEngine->AddOnScreenDebugMessage(-1, 15.0f, FColor::White, fstring);
}
// Called every frame
void UViveportUserDemo::TickComponent(float DeltaTime,
ELevelTick TickType,
FActorComponentTickFunction* ThisTickFunction)
{
Super::TickComponent(DeltaTime, TickType, ThisTickFunction);
}