# Is there any event when the size of Viewport changed?

**URL:** <https://forums.unrealengine.com/t/is-there-any-event-when-the-size-of-viewport-changed/66736>\
**Category:** C++\
**Tags:** unreal-engine\
**Created:** [June 17, 2016, 4:53am UTC](https://forums.unrealengine.com/t/is-there-any-event-when-the-size-of-viewport-changed/66736 "2016-06-17T04:53:07Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![dawnarc](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@dawnarc](https://forums.unrealengine.com/u/dawnarc)\
**Post date:** [June 17, 2016, 4:53am UTC](https://forums.unrealengine.com/t/is-there-any-event-when-the-size-of-viewport-changed/66736/1 "2016-06-17T04:53:07Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![MykonCodes](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@MykonCodes](https://forums.unrealengine.com/u/MykonCodes)\
**Post date:** [June 17, 2016, 7:48am UTC](https://forums.unrealengine.com/t/is-there-any-event-when-the-size-of-viewport-changed/66736/2 "2016-06-17T07:48:03Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![dawnarc](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@dawnarc](https://forums.unrealengine.com/u/dawnarc)\
**Post date:** [June 17, 2016, 9:12am UTC](https://forums.unrealengine.com/t/is-there-any-event-when-the-size-of-viewport-changed/66736/3 "2016-06-17T09:12:33Z")

</div>

> [@;549426](#):
>
> 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!

---

<div class="post-metadata">

**Author:** ![UnrealEverything](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@UnrealEverything](https://forums.unrealengine.com/u/UnrealEverything)\
**Post date:** [June 17, 2016, 3:51pm UTC](https://forums.unrealengine.com/t/is-there-any-event-when-the-size-of-viewport-changed/66736/4 "2016-06-17T15:51:09Z")

</div>

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()

---

<div class="post-metadata">

**Author:** ![dawnarc](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@dawnarc](https://forums.unrealengine.com/u/dawnarc)\
**Post date:** [June 17, 2016, 4:22pm UTC](https://forums.unrealengine.com/t/is-there-any-event-when-the-size-of-viewport-changed/66736/5 "2016-06-17T16:22:49Z")

</div>

> [@UnrealEverything;549672](#):
>
> 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!

---

<div class="post-metadata">

**Author:** ![brenerrr](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@brenerrr](https://forums.unrealengine.com/u/brenerrr)\
**Post date:** [October 20, 2018, 10:28pm UTC](https://forums.unrealengine.com/t/is-there-any-event-when-the-size-of-viewport-changed/66736/6 "2018-10-20T22:28:19Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![dawnarc](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@dawnarc](https://forums.unrealengine.com/u/dawnarc)\
**Post date:** [October 23, 2018, 12:43pm UTC](https://forums.unrealengine.com/t/is-there-any-event-when-the-size-of-viewport-changed/66736/7 "2018-10-23T12:43:53Z")

</div>

> [@brenerrr](#):
>
> Hi! Could you post how you actually bound a function to this delegate? I’m having a hard time doing it. Thanks!

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

```

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_4d9d285f](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_4d9d285f](https://forums.unrealengine.com/u/anonymous_user_4d9d285f)\
**Post date:** [October 25, 2018, 7:07pm UTC](https://forums.unrealengine.com/t/is-there-any-event-when-the-size-of-viewport-changed/66736/8 "2018-10-25T19:07:15Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![s54780478](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@s54780478](https://forums.unrealengine.com/u/s54780478)\
**Post date:** [March 20, 2023, 1:49pm UTC](https://forums.unrealengine.com/t/is-there-any-event-when-the-size-of-viewport-changed/66736/9 "2023-03-20T13:49:28Z")

</div>

I hope to make a game that can be played through windows. Although it should be possible to solve it with C++, I also hope that blueprints have similar events that can be used.

---

<div class="post-metadata">

**Author:** ![NinjaCatFail](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@NinjaCatFail](https://forums.unrealengine.com/u/NinjaCatFail)\
**Post date:** [October 30, 2023, 6:31pm UTC](https://forums.unrealengine.com/t/is-there-any-event-when-the-size-of-viewport-changed/66736/10 "2023-10-30T18:31:28Z")

</div>

ViewportResizedEvent is actually static, so you can get away with this:

```auto
FViewport::ViewportResizedEvent.AddUObject(this, &MyObj::MyFunction);
void MyObj::MyFunction(FViewport* ViewPort, uint32 val) { }

```

---

<div class="post-metadata">

**Author:** ![BOBtheROSS](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@BOBtheROSS](https://forums.unrealengine.com/u/BOBtheROSS)\
**Post date:** [January 14, 2024, 3:45pm UTC](https://forums.unrealengine.com/t/is-there-any-event-when-the-size-of-viewport-changed/66736/11 "2024-01-14T15:45:34Z")

</div>

Just for reference,

I stumbled over this event for Blueprints

**Get Game User Settings → Bind Event To On Game User Settings UI Needs Update**

it doesn’t executes on Play In Editor mode, but it does when using Standalone Game or building the game.

> [@How Create Event OnResize??? Is Possible?](https://forums.unrealengine.com/t/how-create-event-onresize-is-possible/396577/4):
>
> Get Game User Settings → Bind Event To On Game User Settings UI Needs Update This doesn’t work with Editor Viewport size changes only when using Standalone Game or actually building the project Maybe this works with editor viewport size changes : GEngine-\>GameViewport-\>Viewport-\>ViewportResizedEvent.AddUObject(this, &MyObj::MyFunction); void MyObj::MyFunction(FViewport\* ViewPort, uint32 val) { } It’s from this post:

---

<div class="post-metadata">

**Author:** ![letthemicefree](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/letthemicefree/32/989563_2.png) [@letthemicefree](https://forums.unrealengine.com/u/letthemicefree)\
**Post date:** [October 18, 2024, 11:13pm UTC](https://forums.unrealengine.com/t/is-there-any-event-when-the-size-of-viewport-changed/66736/12 "2024-10-18T23:13:02Z")

</div>

If the goal is just to “sense” a resizing, `FViewport::ViewportResizedEvent` is unreliable in certain situation, like on Windows if you press the maximization button. You must also bind with `GEngine->GameViewport->OnToggleFullscreen()` to cover all edge cases.

---

<div class="post-metadata">

**Author:** ![fsprusokowski](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@fsprusokowski](https://forums.unrealengine.com/u/fsprusokowski)\
**Post date:** [January 20, 2025, 3:25pm UTC](https://forums.unrealengine.com/t/is-there-any-event-when-the-size-of-viewport-changed/66736/13 "2025-01-20T15:25:16Z")

</div>

Guys, I am trying to do some actions on vieport resize, but I am stopping in a “simple” error. I understand the delegate and the assign in C++ what I cannot find is the include to FViewport be identified and the program compiled.

Anyone knows? Can please tell me? I find the declaration in the “UnrealClient.h”, but it not work. Maybe is missing some string in build file?

I am using Unreal 5.3.

Thanks.

---

<div class="post-metadata">

**Author:** ![fsprusokowski](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@fsprusokowski](https://forums.unrealengine.com/u/fsprusokowski)\
**Post date:** [January 21, 2025, 2:17am UTC](https://forums.unrealengine.com/t/is-there-any-event-when-the-size-of-viewport-changed/66736/14 "2025-01-21T02:17:04Z")

</div>

Ok, it is just “UnrealClient.h”… I don’t know why do not worked before.

---

<div class="post-metadata">

**Author:** ![Ryujin2003](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/ryujin2003/32/1046197_2.png) [@Ryujin2003](https://forums.unrealengine.com/u/Ryujin2003)\
**Post date:** [May 1, 2025, 12:56pm UTC](https://forums.unrealengine.com/t/is-there-any-event-when-the-size-of-viewport-changed/66736/15 "2025-05-01T12:56:29Z")

</div>

Were you able to get this resolved? I’m stuck on the same exact issue. I understand how to setup the handler and everything, but my program is failing to compile because `UTH001: Unable to find 'class', 'delegate', 'enum', or 'struct' with the name 'FViewport'`. I haven’t been able to get this resolved. I’ve tried to forward declare the class as well, which also didn’t work…

My include:

```cpp
#include "UnrealClient.h"

```

My function:

```cpp
UFUNCTION()
void OnViewportResized(FViewport* Viewport, uint32 Params);

```

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/5/2/e527517f435479778273d216872685850516e5f8.png)

---

<div class="post-metadata">

**Author:** ![K.A.O](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@K.A.O](https://forums.unrealengine.com/u/K.A.O)\
**Post date:** [August 27, 2025, 2:55pm UTC](https://forums.unrealengine.com/t/is-there-any-event-when-the-size-of-viewport-changed/66736/16 "2025-08-27T14:55:34Z")

</div>

> [@Ryujin2003](#):
>
> Were you able to get this resolved? I’m stuck on the same exact issue. I understand how to setup the handler and everything, but my program is failing to compile because `UTH001: Unable to find 'class', 'delegate', 'enum', or 'struct' with the name 'FViewport'`. I haven’t been able to get this resolved. I’ve tried to forward declare the class as well, which also didn’t work…
> 
> My include:
> 
> ```cpp
> #include "UnrealClient.h"
> 
> ```
> 
> My function:
> 
> ```cpp
> UFUNCTION()
> void OnViewportResized(FViewport* Viewport, uint32 Params);
> 
> ```
> 
> ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/5/2/e527517f435479778273d216872685850516e5f8.png)

Hello!

You shouldn’t be using this function with a UFUNCTION() (or UPROPERTY() if wanted FViewport as variable) as this structure is not set as USTRUCT and due to UHT (Unreal Header Tool) it will warn you with `UTH001: Unable to find 'class', 'delegate', 'enum', or 'struct' with the name 'FViewport'`

A solution for your issue would be to include `“UnrealClient.h"`

And create a function (without UFUNCTION() ):

```cpp
void OnViewportResized(FViewport* Viewport, uint32 Params);

```

Then you will no longer have compilation error.

Hope this could help you!
