Are you referring to trying to set the X,Y,and Z after line 5 or are you referring to the code used in line 6?
If you’re tying to set the XYZ valuesthen you should be able to do [vectorVar].X [vectorVar].Y and [vectorVar]z=Z. If you are attempting to get another piece of information from the variable, please indicate exactly what you’re looking for.
We have not heard back from you in a few days, so we are marking this post as Resolved for tracking purposes. If you are still experiencing the issue you reported, please respond to this message with additional information and we will follow up.
For anyone who’s still curious, here’s an example of setting a vector property (or any other struct) in C++:
FName InPropName = "MyVector";
// Ensure InObject is valid
if (InObject)
{
Prop = InObject->GetClass()->FindPropertyByName(InPropName);
// Ensure InObject has this property
if (Prop)
{
void* ValuePtr = Prop->ContainerPtrToValuePtr<void>(InObject);
// Ensure this property is a struct
if (UStructProperty * StructProp = Cast<UStructProperty>(Prop))
{
// Ensure this struct is a Vector
if (StructProp->Struct->GetName() == "Vector")
{
// Set Vector to value
const FVector NewValue = FVector(1234, 3452.938475, -34);
StructProp->CopyCompleteValue(ValuePtr, &NewValue);
}
}
// Commit changes
Prop->PostEditChange();
}
}