Unable to get mobile viewport size (C++)


I am working on an Input Manager for my game and the following code is working in the editor, but not in the standalone version of the mobile package (Android Samsung tablet):

const FVector2D ViewportSize = FVector2D(GEngine->GameViewport->Viewport->GetSizeXY());

My question is : How can I get the viewport size in the standalone package of the mobile device ?
Thanks for your replies !

Try calling the function after a 0.2 seconds delay.

I know it sounds hacky, but this is what’s currently used in TappyChicken blueprints.


Yeah, it works. Thanks man!