Download

Is there any event when the size of Viewport changed?

I want to calculate variables only when the size of Viewport be changed, not calculate in **Tick **function, is there any event would trigger when Viewport be resized?

you can just check yourself in Tick() if it changed, if yes, you calculate your new values.
Two Integer comparsions and an if-statement per tick is absolutely nothing, if optimization is your reason why you don’t want to have it in tick.
As far as I am aware of, there is no BP exposed event for this purpose.

Thx for your suggestion!

FViewport::ViewportResizedEvent might be what you’re looking for? It’s a regular (non-dynamic) multicast delegate with two parameters. The first one is the FViewport* through which you can call GetSizeXY()

Exactly! that’s what I need, thx so much! I love u!

Hi! Could you post how you actually bound a function to this delegate? I’m having a hard time doing it. Thanks!

GEngine->GameViewport->Viewport->ViewportResizedEvent.AddUObject(this, &MyObj::MyFunction); void MyObj::MyFunction(FViewport* ViewPort, uint32 val) { }

Used to be in older Direct X version that you could use GETSYSTEMMETRICS and within this you could find window size and many other options. I literally just loaded this engine tonight and havent programmed in over 8 years… but might be worth something to look into… i know unreal is running on direct x but not sure if direct x 7 features are still available after direct x 10 was created.