I have a Blueprint that inherits from a C++ class that inherits from UBlueprintFunctionLibrary
From within the blueprint, I need to be able to get the viewport size to get the current screen resolution… However, GetViewportSize is not available. Assuming it’s because of the C++ class inherits from UBlueprintFunctionLibrary.
I tried another option which is to use the PlayerController → GetViewportSize. In the BP, Those two wire up fine, but, I am not sure how to construct the PlayerController from my BP. I’ve tried a couple options, but it does not seem to work.
How do you get/or construct the player controller, from inside a BP, that inherits from a C++ class that inherits from UBlueprintFunctionLibrary?
OR
How do you get the viewport size given this particular class heirarchy? The BP Node “GetViewportSize” is not available.
Thanks all.
You would use the regular GetPlayerController node. The trick is the world context object input, which since you’re in a blueprint library function won’t be immediately apparent. However there should be a node available ‘Get World Context’ which is available as a sort of hidden input parameter to every function of a blueprint function library. At least when you’re making one in blueprint.
Well, honestly because I didn’t know about this node. This might be the very exact thing I need. Because the C++ class needs a FIntPoint anyway as it’s input… This might be the absolute perfect solution.
EDIT…
Yep, absolutely perfect solution! Works exactly as I needed.
THANK YOU SO MUCH ROY!