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.
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.
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