# Display different UMG UI according to the platform?

**URL:** <https://forums.unrealengine.com/t/display-different-umg-ui-according-to-the-platform/371355>\
**Category:** UI\
**Tags:** cross-platform, unreal-engine, FeatureRequest, UI, Blueprint, question, UMG\
**Created:** [September 23, 2016, 1:48am UTC](https://forums.unrealengine.com/t/display-different-umg-ui-according-to-the-platform/371355 "2016-09-23T01:48:39Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![crtapps](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@crtapps](https://forums.unrealengine.com/u/crtapps)\
**Post date:** [September 23, 2016, 1:48am UTC](https://forums.unrealengine.com/t/display-different-umg-ui-according-to-the-platform/371355/1 "2016-09-23T01:48:39Z")

</div>

Hi all,

Does anyone know how to display different UMG UI according to the platform(including the device simulation, e.g, setting Target Platform to Mobile and PIE the game on Windows.)? Just like Virtual Joystick.

Thank a lot.

---

<div class="post-metadata">

**Author:** ![Shadowriver](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Shadowriver](https://forums.unrealengine.com/u/Shadowriver)\
**Post date:** [September 23, 2016, 2:34am UTC](https://forums.unrealengine.com/t/display-different-umg-ui-according-to-the-platform/371355/2 "2016-09-23T02:34:13Z")

</div>

There is no passive method for that, you need to make stuff visible or load specific widget depending on platfrom name from here:

> **[Get Platform Name](https://docs.unrealengine.com/5.1/en-US/BlueprintAPI/Game/GetPlatformName/)**
>
> Get Platform Name

You can’t detect PIE in blueprints, you would need to make your own nodes (which is not that hard) in C++ using those functions in world instance:

> **[UWorld::IsPlayInEditor](https://docs.unrealengine.com/5.1/en-US/API/Runtime/Engine/Engine/UWorld/IsPlayInEditor/)**
>
> Returns whether script is executing within the editor.

> **[UWorld::IsPlayInMobilePreview](https://docs.unrealengine.com/5.1/en-US/API/Runtime/Engine/Engine/UWorld/IsPlayInMobilePreview/)**
>
> Returns whether script is executing within a mobile preview window

---

<div class="post-metadata">

**Author:** ![crtapps](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@crtapps](https://forums.unrealengine.com/u/crtapps)\
**Post date:** [September 23, 2016, 4:07am UTC](https://forums.unrealengine.com/t/display-different-umg-ui-according-to-the-platform/371355/3 "2016-09-23T04:07:15Z")

</div>

Thanks for you reply, but I have another problem.

I wrote a BlueprintCallable function named ‘IsPlayInMobilePreview’ in my PlayerController and call it in my HUD blueprint with the Event BeginPlay.

My IsPlayInMobilePreview function’s implementation is just call another function in UWorld, like this:

return ()-\>IsPlayInMobilePreview();

But it always return false. I debugged it and found the real reason is:

FParse::Param(FCommandLine::Get(), TEXT(“simmobile”));

always get FALSE result.

I have tried launch the game with -simmobile commandline parameter and PIE with Mobile Preview, but get the same result, it’s always FALSE.

How do I solve this problem?

---

<div class="post-metadata">

**Author:** ![Shadowriver](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Shadowriver](https://forums.unrealengine.com/u/Shadowriver)\
**Post date:** [September 23, 2016, 4:10pm UTC](https://forums.unrealengine.com/t/display-different-umg-ui-according-to-the-platform/371355/4 "2016-09-23T16:10:10Z")

</div>

You not using in that preview right?

---

<div class="post-metadata">

**Author:** ![crtapps](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@crtapps](https://forums.unrealengine.com/u/crtapps)\
**Post date:** [September 26, 2016, 10:37am UTC](https://forums.unrealengine.com/t/display-different-umg-ui-according-to-the-platform/371355/5 "2016-09-26T10:37:00Z")

</div>

Yes, no .

---

<div class="post-metadata">

**Author:** ![meinukey1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@meinukey1](https://forums.unrealengine.com/u/meinukey1)\
**Post date:** [August 2, 2022, 4:03pm UTC](https://forums.unrealengine.com/t/display-different-umg-ui-according-to-the-platform/371355/6 "2022-08-02T16:03:46Z")

</div>

I know this thread is old, but I’ll post the solution here for anyone who might need it, since checking the -simmobile argument is still used in `UWorld::IsPlayInMobilePreview()` and yet doesn’t work as of 2022.  
You can use `FSlateApplication::Get().IsFakingTouchEvents()` to check for editor mobile preview and check if the return string from `UGameplayStatics::GetPlatformName()` equals to any mobile platform for standalone/packaged builds.

---

<div class="post-metadata">

**Author:** ![Lawendt](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/lawendt/32/473603_2.png) [@Lawendt](https://forums.unrealengine.com/u/Lawendt)\
**Post date:** [August 4, 2022, 3:42pm UTC](https://forums.unrealengine.com/t/display-different-umg-ui-according-to-the-platform/371355/7 "2022-08-04T15:42:50Z")

</div>

Common UI has a more generic approach to platform traits, which are gameplay tags you can define in each platform to then enable/disable features as desired. Even without using this plugin, it’s a nice way of designing this system
