FString to TCHAR

Hi! I want to convert FString to TCHAR to be able to put FString value insted of TEXT("")

Something like this:

static ConstructorHelpers::FObjectFinder<UParticleSystem> ParticleObj(TEXT("ParticleSystem'/Game/Rolling/P_Beam.P_Beam'"));

// to

static ConstructorHelpers::FObjectFinder<UParticleSystem> ParticleObj(MyConverted FString to TCHAR));

Does some one know how to do this?

ParticleObj needs to be an accessible property of MyConvertedFStringtoTChar whatever that ends up being, in which case you can set it up like so

static ConstructorHelpers::FObjectFinder ParticleObj(*(MyconvertedFStringtoTCHAR->ParticleObj));

FObjectFinder is looking for a const TCHAR* and the TEXT(“ParticleSystem’/Game/Rolling/P_Beam.P_Beam’”) example from above gives you that TCHAR* return and so dereferencing the FString used above the ParticleObj allows FObjectFinder to take in the TCHAR* const it needs.

Theres also the ANSI_TO_TCHAR macro to get around the need for TEXT()

Theres really not a lot of methods that I know of otherwise. You might have to search around for string conversion.

Hope this helps
Don’t forget to accept an answer that best clears your question up or answers it so when the community finds your question in the future via search/google they know exactly what you did to fix it/get it going.

Thanks! I’ll check it tomorrow.