I’m trying to game my game directory using FPaths but I get an error (unreferenced local variable). I know I must have silly mistake but I am not a programmer. Can anyone point the problem?
.cpp
FString UDialogueHandler::GetGameDir(FString DirectoryName)
{
FPaths Path;
DirectoryName = Path.GameDir();
return DirectoryName;
}
.h
UFUNCTION(BlueprintPure, Category = "DialogueHandler")
static FString GetGameDir(FString DirectoryName);
Can you try this:
.h
UFUNCTION(BlueprintPure, Category = "DialogueHandler")
static FString GetGameDir();
FString UDialogueHandler::GetGameDir()
{
return FPaths::ConvertRelativePathToFull(FPaths::GameDir());
}
Hi ryanjob2040, really appreciate the help.
I just changed the return to
FString UDialogueHandler::GetGameDir(FString DirectoryName)
{
return FPaths::GameContentDir(); // Get the game content directory
}
And it seems to work fine.
but seems like you are using a better method. Im gonna change it and see the outcome.
Thanks a tons!
Edit: Just tried return FPaths::ConvertRelativePathToFull(FPaths::GameDir()); and it gave me the full path!