I am a cpp developer and I am learning the unreal engine by your course but there is something occupied my mind and that is why we can’t initialize the fvector liuke this:FVector MyVector(1, 2, 3). Because in cpp we can call a constructor of a struct like this but,In unreal we have to call like this:FVector MyVector = FVector(1.2f, 3.4f, 6.1f);.why?
You’ll have to be more specific about the surrounding code, details about where you’re declaring it or the error that you’re getting when you try.
It works just fine for me.
both syntaxes actually work in UE C++. FVector MyVector(1,2,3) and FVector(1.2f,3.4f,6.1f) both call the same constructor, your error is elsewhere.
most common trap: you wrote it inside a UCLASS header as a member default without = or {}, like FVector MyVector(1,2,3); that is illegal in a class body. in a header either do FVector MyVector = FVector(1,2,3); or FVector MyVector{1,2,3};. in a .cpp function body MyVector(1,2,3) is fine. paste the exact error line if it still fails.