# FVector MyVector = FVector(1.2f, 3.4f, 6.1f);why it doesn’t work?  

**URL:** <https://forums.unrealengine.com/t/fvector-myvector-fvector-1-2f-3-4f-6-1f-why-it-doesn-t-work/2762353>\
**Category:** C++\
**Tags:** unreal-engine, question, CPP\
**Created:** [September 3, 2026, 5:49pm UTC](https://forums.unrealengine.com/t/fvector-myvector-fvector-1-2f-3-4f-6-1f-why-it-doesn-t-work/2762353 "2026-09-03T17:49:26Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Blabla1356](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/blabla1356/32/1203294_2.png) [@Blabla1356](https://forums.unrealengine.com/u/Blabla1356)\
**Post date:** [September 3, 2026, 5:49pm UTC](https://forums.unrealengine.com/t/fvector-myvector-fvector-1-2f-3-4f-6-1f-why-it-doesn-t-work/2762353/1 "2026-09-03T17:49:26Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![MagForceSeven](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/magforceseven/32/906563_2.png) [@MagForceSeven](https://forums.unrealengine.com/u/MagForceSeven)\
**Post date:** [September 3, 2026, 7:34pm UTC](https://forums.unrealengine.com/t/fvector-myvector-fvector-1-2f-3-4f-6-1f-why-it-doesn-t-work/2762353/2 "2026-09-03T19:34:23Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![ShadowBr0kerz](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/shadowbr0kerz/32/1201558_2.png) [@ShadowBr0kerz](https://forums.unrealengine.com/u/ShadowBr0kerz)\
**Post date:** [September 8, 2026, 8:54am UTC](https://forums.unrealengine.com/t/fvector-myvector-fvector-1-2f-3-4f-6-1f-why-it-doesn-t-work/2762353/3 "2026-09-08T08:54:25Z")

</div>

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.
