RealDocs

UKismetStringLibrary::Conv_StringToVector

function Engine Blueprint Since unknown
#include "Kismet/KismetStringLibrary.h"
Access: public Specifiers: staticBlueprintPure

Description

Parses a string in the 'X= Y= Z=' format produced by Conv_VectorToString back into an FVector, reporting whether parsing succeeded via OutIsValid.

Caveats & Gotchas

  • Internally calls FVector::InitFromString, which parses X, Y and Z independently — a string missing one component can still report success for the ones it found, so OutConvertedVector may only be partially populated even when OutIsValid is true.
  • Always branch on OutIsValid before using OutConvertedVector; on failure the vector isn't guaranteed to be reset to zero, it may retain whatever value was passed in.

Signature

static void Conv_StringToVector(const FString& InString, FVector& OutConvertedVector, bool& OutIsValid)

Parameters

Name Type Description Default
InString const FString& The string to parse, expected in the 'X= Y= Z=' format.
OutConvertedVector FVector& The parsed vector value; only meaningful when OutIsValid is true.
OutIsValid bool& True if InString was successfully parsed into a vector.

Return Type

void

Example

Round-trip a vector through a string C++
FString VectorText = TEXT("X=100.000 Y=0.000 Z=50.000");
FVector ParsedLocation;
bool bIsValid = false;
UKismetStringLibrary::Conv_StringToVector(VectorText, ParsedLocation, bIsValid);
if (bIsValid)
{
	SetActorLocation(ParsedLocation);
}

Version History

Introduced in: unknown

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.