How would I go about using an FString in place of TEXT(“”)
For example, In ConstructorHelpers::FObjectFinder it calls for TEXT(“”)
Example:
static ConstructorHelpers::FObjectFinder SoldierLandSoundObj(TEXT("SoundCue'/Game/Sounds/MonsterLand.MonsterLand'"));
However, How would I do something like
static ConstructorHelpers::FObjectFinder SoldierLandSoundObj(SoundLocations->SoldierLandSound); //Where "SoldierLandSound" returns an FString
2 Likes
If SoldierLandSound is an accessible property of SoundLocations,
do this:
static ConstructorHelpers::FObjectFinder SoldierLandSoundObj(*(SoundLocations->SoldierLandSound));
FObjectFinder wants a const TCHAR* (Which is what that TEXT() macro gives us), so dereferencing the FString gives it what it wants.
fkkcloud
(cloud)
4
But is there an actual way to convert FString into TCHAR?
Day_xia
(Day_xia)
5
you could also try
FText TextVariable = FText::AsCultureInvariant(YourStringVariable);
because the string variable could be anything it can’t give you a translatable option.
1 Like