The docs say to use include “Templates/SharedPointer.h” but no matter what I try I’m unable to get my C++ Bp function class to compile when using TSharedRef. The Unreal Build Tool throws the error UBT001:Unable to find 'class', 'delegate', 'enum', or 'struct' with name 'TSharedRef'
What am i missing here?
GuidUtils.h
#pragma once
#include "CoreMinimal.h"
#include "Templates/SharedPointer.h"
#include "GuidUtils.generated.h"
UENUM(BlueprintType)
enum EResult {
Success,
Failure
};
UCLASS()
class VR_BASE_API UGuidExtensions : public UBlueprintFunctionLibrary{
GENERATED_BODY()
public:
UFUNCTION(BlueprintCallable, Category = "MessageUtils", meta = (DisplayName = "Try Parse Guid (Message)", BlueprintThreadSafe, ExpandEnumAsExecs = "result"))
static TSharedRef<FGuid>& TryParseGuid(
UPARAM(ref) const FString& message,
TEnumAsByte<EResult >& result
);
}
GuidUtils.cpp
TSharedRef<FGuid>& TryParseGuid(
UPARAM(ref) const FString& message,
TEnumAsByte<EResult >& result
){
//Declare local variable
FString strGuid;
//Truncated: Message handling populates local variable with a Guid string
TSharedRef<FGuid>& guidOut;
if(FGuid::Parse(strGuid, guidOut)){
result = Success;
}else{
result = Failure;
}
}
Edit: Fixed formatting failure.