# How to see what platform game is running on?

**URL:** <https://forums.unrealengine.com/t/how-to-see-what-platform-game-is-running-on/311518>\
**Category:** C++\
**Tags:** how-to, unreal-engine, Platform, UE4, CPP, question\
**Created:** [March 18, 2015, 10:23am UTC](https://forums.unrealengine.com/t/how-to-see-what-platform-game-is-running-on/311518 "2015-03-18T10:23:17Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_75f3f229](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_75f3f229](https://forums.unrealengine.com/u/anonymous_user_75f3f229)\
**Post date:** [March 18, 2015, 10:23am UTC](https://forums.unrealengine.com/t/how-to-see-what-platform-game-is-running-on/311518/1 "2015-03-18T10:23:17Z")

</div>

In c++, how do I see what platform the game is currently running on/compiled for?

---

<div class="post-metadata">

**Author:** ![Omar\_Vector\_dupe](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Omar\_Vector\_dupe](https://forums.unrealengine.com/u/Omar_Vector_dupe)\
**Post date:** [March 18, 2015, 11:41am UTC](https://forums.unrealengine.com/t/how-to-see-what-platform-game-is-running-on/311518/2 "2015-03-18T11:41:39Z")

</div>

Basically, C++ compile your source code to run on your machine Win/Mac, However, Inside the editor,You will have the ability to build your game to run on a different platform such as Android.

this means VS only build your game to run through your engine on Win/Mac platform, while The Editor itself who is responsible for building your final game to run on others platforms.

If I missed something, Please someone fixed it.

Best of luck

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_75f3f229](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_75f3f229](https://forums.unrealengine.com/u/anonymous_user_75f3f229)\
**Post date:** [March 18, 2015, 11:51am UTC](https://forums.unrealengine.com/t/how-to-see-what-platform-game-is-running-on/311518/3 "2015-03-18T11:51:51Z")

</div>

Thank you for the answer but that doesn’t answer my question. The question was: how do I, in code, see what platform my game is running on?

---

<div class="post-metadata">

**Author:** ![eXi](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/exi/32/906583_2.png) [@eXi](https://forums.unrealengine.com/u/eXi)\
**Post date:** [March 18, 2015, 12:06pm UTC](https://forums.unrealengine.com/t/how-to-see-what-platform-game-is-running-on/311518/4 "2015-03-18T12:06:11Z")

</div>

Do you mean something like this?

This is an extract of the ShooterGame. I guess you can use this if statement in your normal class too:

```
if ((Target.Platform == UnrealTargetPlatform.Win32) || (Target.Platform == UnrealTargetPlatform.Win64) || (Target.Platform == UnrealTargetPlatform.Linux) || (Target.Platform == UnrealTargetPlatform.Mac))
		{
			if (UEBuildConfiguration.bCompileSteamOSS == true)
			{
				DynamicallyLoadedModuleNames.Add("OnlineSubsystemSteam");
			}

			DynamicallyLoadedModuleNames.Add("OnlineSubsystemNull");
		}
		else if (Target.Platform == UnrealTargetPlatform.PS4)
		{
			DynamicallyLoadedModuleNames.Add("OnlineSubsystemPS4");
		}
        else if (Target.Platform == UnrealTargetPlatform.XboxOne)
        {
            DynamicallyLoadedModuleNames.Add("OnlineSubsystemLive");
        }

```

I just took the whole part. Only the ifs are insteresting for your though.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_957a4452](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_957a4452](https://forums.unrealengine.com/u/anonymous_user_957a4452)\
**Post date:** [March 18, 2015, 1:04pm UTC](https://forums.unrealengine.com/t/how-to-see-what-platform-game-is-running-on/311518/5 "2015-03-18T13:04:52Z")

</div>

Hi ,

You can try to use this:

```
UGameplayStatics::GetPlatformName();

```

Also, if you want add some platform depended code you can use this macros

```
    PLATFORM_MAC
    PLATFORM_WINDOWS
    PLATFORM_LINUX
    PLATFORM_IOS
    PLATFORM_ANDROID
    WITH_EDITOR

```

Hope it helps!

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_75f3f229](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_75f3f229](https://forums.unrealengine.com/u/anonymous_user_75f3f229)\
**Post date:** [March 18, 2015, 4:17pm UTC](https://forums.unrealengine.com/t/how-to-see-what-platform-game-is-running-on/311518/6 "2015-03-18T16:17:48Z")

</div>

Thanks that was just what i was looking for!

---

<div class="post-metadata">

**Author:** ![BrUnO\_XaVIeR](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/bruno_xavier/32/1110230_2.png) [@BrUnO\_XaVIeR](https://forums.unrealengine.com/u/BrUnO_XaVIeR)\
**Post date:** [August 24, 2015, 2:24am UTC](https://forums.unrealengine.com/t/how-to-see-what-platform-game-is-running-on/311518/7 "2015-08-24T02:24:28Z")

</div>

How do I check in C++ module, instead of UBT C#, if the target platform is x32 or x64?

Just like we do in .Build files, but I need this to load a dynamic DLL and need to check if the game built will be 64bits or not…

Edit:  
Found it, just need to use #PLATFORM\_32BITS directive.
