Resize Actor/mesh depending on viewport size

Where do you implement this code? I would guess in BeginPlay()? If you implement it instead into some tick function (to resize the Actor on Game Runtime), then the GetActorBounds would be fatal, because it changes everytime when SetRelativeScale3D is called.

Another thing i can see is, that you divide the Width and Height directly by your FieldSize.X and Y. This can not work out… Here is why:

Every Vector is only meaningfull with respect to some basis (origin) which span his vectorspace. The basis for FieldSize is the World Origin of your Map with the orthogonal unit Vectors (length one UE = 1 cm) X, Y and Z. The basis for Viewportsize on the other hand is the upper left (i think) corner of of the viewport with the orthogonal unit Vectors (length one pixel = ?? cm).

Because their basis is not the same, you cant just simply divide them and get a meaningfull result.

I would recommend that you make 2 new UPROPERTY in your actor which are StandardWidth and StandardHeight (both represent Vectors w.r.t. your screen) and use them as your standard values. With these Propertys you can play around in the Editor to Resive the size you want on your viewport.

Then, if you scale your viewport everything should just scale fine.