Question about the auto specifier and the FVector2D

Hello I got some doubts about this 2.
When should I use the auto specifier? I looked on the cppreference site and I understand why it’s used but IDK when to use; on the challenge I made like this:

FVector2D ScreenLocation = ((ViewportSizeX)(CroosHairXLocation), (ViewportSizeY)(CroosHairYLocation));

But I got an error that the Fvector2D can’t operatew with a float variable, but I keep think that the solution on the video and mine are basically the same and i really don’t know why they are not.

You’re not using the constructor with that you are doing something similar to

int x = (3, 10); // x == 10

So you are effectively trying to initialise it to a single float. To use it correctly you need to get rid if the =

FVector2D ScreenLocation(ViewportSizeX* CroosHairXLocation, ViewportSizeY* CroosHairYLocation);

Oh thank you very much, now it makes sense haha

Privacy & Terms