# PIE実行の度に、ウィンドウサイズが変化してしまう

**URL:** <https://forums.unrealengine.com/t/pie/1166141>\
**Category:** 日本語 (Japanese)\
**Tags:** unreal-engine, bug-report, editor, Blueprint, question\
**Created:** [May 15, 2023, 6:56am UTC](https://forums.unrealengine.com/t/pie/1166141 "2023-05-15T06:56:17Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rwi](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/rwi/32/633299_2.png) [@Rwi](https://forums.unrealengine.com/u/Rwi)\
**Post date:** [May 15, 2023, 6:56am UTC](https://forums.unrealengine.com/t/pie/1166141/1 "2023-05-15T06:56:17Z")

</div>

Editor Preferences → Level Editor - Play → Game Viewport Settings にて、

**「ディスプレイの拡大率が100%以外」**  
かつ  
**「Always center first viewport window to screen」がOFF**

の場合、PIE実行 → プレイを終了する度に「New Viewport Resolution」の値が一定数増加する、という現象が発生しています。（ UE5.1.1 と、インストール直後の UE5.2 で同様の現象を確認）

この現象について、情報や解決策はありますか？

* * *

また、代替策として「ウィンドウの位置」をBPで操作できればと考えたのですが、その方法が分かりませんでした。そのような操作はBPで可能ですか？

* * *

【説明画像】

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/d/4/0d4b6ee9e4ac6b04f78bc33f070adfe1a5c52eb9.png)  
▲ ディスプレイの解像度設定

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/5/4/154dbf78e5fccd9a81f7bb980d0cae3ee62cb0ce.png)

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/9/c/39c69b75d0f85748a9715cba6f841064c49e4113.png)

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/6/c/46cbee2a8c1ee8289927d8f2fbe9ac769ed4d86f.png)  
▲ 実行の度に3×20ずつ、ウィンドウサイズが変化してしまう

* * *

【同様の質問事例】

> [@Viewport resolution keep getting larger after play in new window everytime](https://forums.unrealengine.com/t/viewport-resolution-keep-getting-larger-after-play-in-new-window-everytime/593580):
>
> After everytime I play the level in a new window the viewport resolution will automatically increase by 2(width) and 10(Height) Anyone has a solution?

> [@\[BUG\] New ViewPort size increases by (2x8) every time you press play](https://forums.unrealengine.com/t/bug-new-viewport-size-increases-by-2x8-every-time-you-press-play/476564/4):
>
> I am not affected by this. Is this occurring from a completely blank project?

---

<div class="post-metadata">

**Author:** ![s-tsuneyasu](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@s-tsuneyasu](https://forums.unrealengine.com/u/s-tsuneyasu)\
**Post date:** [May 19, 2023, 8:57am UTC](https://forums.unrealengine.com/t/pie/1166141/2 "2023-05-19T08:57:14Z")

</div>

ご報告いただいている現象は UE5 の不具合のようで、修正は UE5.4 の予定とのことでした。

> **[The Unreal Engine Issues and Bug Tracker](https://issues.unrealengine.com/issue/UE-162908)**
>
> Welcome to the Unreal Engine Issue and Bug Tracker. You can check the status of an issue and search for existing bugs. See latest bug fixes too.

また、ウィンドウの位置については、  
デフォルトでは BP にそのような関数は用意されていませんが、  
C++ で関数を作成して BP に公開すれば可能です。

```auto
void SetWindowPosition(FVector2D InPos)
{
	GEngine->GameViewport->GetWindow()->MoveWindowTo(InPos);
}

```

上記の関数を FunctionLibrary や Subsystem 等で UFUNCTION(BlueprintCallable)を設定して、レベル BP の BeginPlay 等で呼び出せば変更されると思います。

---

<div class="post-metadata">

**Author:** ![Rwi](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/rwi/32/633299_2.png) [@Rwi](https://forums.unrealengine.com/u/Rwi)\
**Post date:** [May 19, 2023, 10:18am UTC](https://forums.unrealengine.com/t/pie/1166141/3 "2023-05-19T10:18:22Z")

</div>

ご回答ありがとうございます！  
EpicGamesが把握済みのバグであり、将来的に修正予定とのことで、とても安心しました。

C++での解決方法につきましても、C++での操作知識がまだ無い為、今すぐ自身で検証はできないのですが、今後多くの方の助けとなる情報だと思います。貴重な情報を、どうもありがとうございました！ 🙏

---

<div class="post-metadata">

**Author:** ![Rwi](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/rwi/32/633299_2.png) [@Rwi](https://forums.unrealengine.com/u/Rwi)\
**Post date:** [May 19, 2023, 10:19am UTC](https://forums.unrealengine.com/t/pie/1166141/4 "2023-05-19T10:19:41Z")

</div>

【追記 - 参考になりそうなリンク】

> **[SWindow::MoveWindowTo](https://docs.unrealengine.com/5.1/en-US/API/Runtime/SlateCore/Widgets/SWindow/MoveWindowTo/)**
>
> Relocate the window to a screenspace position specified by NewPosition

▲ SWindow::MoveWindowTo

> **[Window Extension：コードプラグイン - UE マーケットプレイス](https://www.unrealengine.com/marketplace/ja/product/viewport-extension)**
>
> This plugin allows you to interact with the Viewport

▲ ウィンドウ操作関連のコードプラグイン

---

<div class="post-metadata">

**Author:** ![system](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/1/3/713c9d3f58553f0de89543d76a8a3a2779dc9fa4.png) [@system](https://forums.unrealengine.com/u/system)\
**Post date:** [June 18, 2023, 10:20am UTC](https://forums.unrealengine.com/t/pie/1166141/5 "2023-06-18T10:20:22Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
