# Shipping build do not accept comand line arguments

**URL:** <https://forums.unrealengine.com/t/shipping-build-do-not-accept-comand-line-arguments/302472>\
**Category:** Community & Industry Discussion\
**Tags:** command-line-argumen, unreal-engine, shipping-build, bug-report, question\
**Created:** [December 26, 2014, 6:40am UTC](https://forums.unrealengine.com/t/shipping-build-do-not-accept-comand-line-arguments/302472 "2014-12-26T06:40:18Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![\_h2o](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@\_h2o](https://forums.unrealengine.com/u/_h2o)\
**Post date:** [December 26, 2014, 6:40am UTC](https://forums.unrealengine.com/t/shipping-build-do-not-accept-comand-line-arguments/302472/1 "2014-12-26T06:40:18Z")

</div>

Tested with 4.5.1 and 4.6.0 and 4.6.1  
Shipping build do not accept comand line arguments like “?Param1=Value1?Param2=Value2”.  
Is it a bug, or there is some trick to turn it on?

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_890dc646](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_890dc646](https://forums.unrealengine.com/u/anonymous_user_890dc646)\
**Post date:** [December 26, 2014, 10:16am UTC](https://forums.unrealengine.com/t/shipping-build-do-not-accept-comand-line-arguments/302472/2 "2014-12-26T10:16:30Z")

</div>

Did you custom the console command that is being used by you? First you should know that UE will not allow you run most console command when you shipping your project, unless you created it and parsed it self.

---

<div class="post-metadata">

**Author:** ![\_h2o](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@\_h2o](https://forums.unrealengine.com/u/_h2o)\
**Post date:** [December 26, 2014, 12:06pm UTC](https://forums.unrealengine.com/t/shipping-build-do-not-accept-comand-line-arguments/302472/3 "2014-12-26T12:06:16Z")

</div>

It is not console commands. I have my own launch parameters and I parse them. Shipping build have no log output so I can’t to see what is going wrong there.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_890dc646](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_890dc646](https://forums.unrealengine.com/u/anonymous_user_890dc646)\
**Post date:** [December 26, 2014, 3:50pm UTC](https://forums.unrealengine.com/t/shipping-build-do-not-accept-comand-line-arguments/302472/4 "2014-12-26T15:50:57Z")

</div>

You can unzip your package for checking the parameters if has been added to the launch command line. There is one launch command txt file in your final package. If my memory is correctly. Have you tested in development mode?

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_890dc646](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_890dc646](https://forums.unrealengine.com/u/anonymous_user_890dc646)\
**Post date:** [December 26, 2014, 4:12pm UTC](https://forums.unrealengine.com/t/shipping-build-do-not-accept-comand-line-arguments/302472/5 "2014-12-26T16:12:06Z")

</div>

UE launch command template is :: …/…/…/Samples/Showcases/Mobile/Mobile.uproject -filehostip=###.###.###.### -nosound -streaming. It seems like it will not register new parameter as you added . If you can launch your game with your customization arguments in development mode. It seems like your parse code has been forbid run when you shipping your game. So you just need to adjust the place of your code.

---

<div class="post-metadata">

**Author:** ![\_h2o](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@\_h2o](https://forums.unrealengine.com/u/_h2o)\
**Post date:** [December 26, 2014, 4:21pm UTC](https://forums.unrealengine.com/t/shipping-build-do-not-accept-comand-line-arguments/302472/6 "2014-12-26T16:21:54Z")

</div>

With development build it works fine. Issue happened only with shipping build

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_890dc646](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_890dc646](https://forums.unrealengine.com/u/anonymous_user_890dc646)\
**Post date:** [December 26, 2014, 4:33pm UTC](https://forums.unrealengine.com/t/shipping-build-do-not-accept-comand-line-arguments/302472/7 "2014-12-26T16:33:31Z")

</div>

It indicates the parse code was written in wrong place. Your code was forbidden to exec by UE\_SHIPPING\_BUILD macro. The UE\_SHIPPING\_BUILD macro always is false in shipping build.

---

<div class="post-metadata">

**Author:** ![\_h2o](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@\_h2o](https://forums.unrealengine.com/u/_h2o)\
**Post date:** [December 27, 2014, 10:31am UTC](https://forums.unrealengine.com/t/shipping-build-do-not-accept-comand-line-arguments/302472/8 "2014-12-27T10:31:08Z")

</div>

there is no macro in my code:  
i am launching **shipping build x32** with that line:

> game.exe  
> ?Name=TestUser?id=1?serv=127.0.0.1?port=15?ql=2?lng=Russian

this parameters string is parsed at game start:  
void AGameGameMode::InitGame(const FString& MapName, const FString& Options, FString& ErrorMessage)  
{  
const FString lname = ParseOption(Options, “name”);  
const int32 lid = GetIntOption(Options, “id”, 0);  
const FString lip = ParseOption(Options, “serv”);  
const int32 lport = GetIntOption(Options, “port”, 0);  
const int32 lquality = GetIntOption(Options, “ql”, 0);  
const FString llng = ParseOption(Options, “lng”);

```
    	Super::InitGame(MapName, Options, ErrorMessage);

        // other code
    }

```

so, no one of those params goes to InitGame(). It is look like Options=“” so it is empty string.

**when launching development build x64 with same line, then Options string have all parameters i set for launch**

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_890dc646](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_890dc646](https://forums.unrealengine.com/u/anonymous_user_890dc646)\
**Post date:** [December 27, 2014, 11:11am UTC](https://forums.unrealengine.com/t/shipping-build-do-not-accept-comand-line-arguments/302472/9 "2014-12-27T11:11:50Z")

</div>

Ok, Do you want to use these parameters when you travel to new map or in the default map when the engine was started? this function is used to create one game mode when you travel to new map. These parameters should be included into the map url, it should be looked like: testmap?game=mygamemode?id= . and you can invoke servertravel function to travel the url, and then you can correctly parse them in your project.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_890dc646](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_890dc646](https://forums.unrealengine.com/u/anonymous_user_890dc646)\
**Post date:** [December 27, 2014, 11:54am UTC](https://forums.unrealengine.com/t/shipping-build-do-not-accept-comand-line-arguments/302472/10 "2014-12-27T11:54:03Z")

</div>

Here is the code that epic uses to create the game mode for default map when game engine is being loaded.

void UGameInstance::StartGameInstance()  
{  
UEngine\* const Engine = GetEngine();

```
// Create default URL.
// @note: if we change how we determine the valid start up map update LaunchEngineLoop's GetStartupMap()
FURL DefaultURL;
DefaultURL.LoadURLConfig(TEXT("DefaultPlayer"), GGameIni);

// Enter initial world.
EBrowseReturnVal::Type BrowseRet = EBrowseReturnVal::Failure;
FString Error;
TCHAR Parm[4096] = TEXT("");
const TCHAR* Tmp = FCommandLine::Get();

```

#if UE\_BUILD\_SHIPPING  
// In shipping don’t allow an override  
Tmp = TEXT(“”);  
#endif // UE\_BUILD\_SHIPPING

//other code  
}

so you can get the real reason in here.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_b666e59e](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_b666e59e](https://forums.unrealengine.com/u/anonymous_user_b666e59e)\
**Post date:** [January 6, 2015, 3:36pm UTC](https://forums.unrealengine.com/t/shipping-build-do-not-accept-comand-line-arguments/302472/11 "2015-01-06T15:36:06Z")

</div>

Hi h2o,

I created a new project to test this issue in, and I was not able to see the same results that you described. I used the code first person template and added the code you provided in one of your comments to the default GameMode class that came with the template. I then made a Blueprint from that GameMode class to output the values retrieved from the command line arguments to the screen. I packaged the game for both Win64 and Win32, and with both versions of the packaged game the values that were output matched the arguments I sent in through the command line.

Could you provide some more details about how you are setting this up?

---

<div class="post-metadata">

**Author:** ![\_h2o](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@\_h2o](https://forums.unrealengine.com/u/_h2o)\
**Post date:** [January 8, 2015, 10:07am UTC](https://forums.unrealengine.com/t/shipping-build-do-not-accept-comand-line-arguments/302472/12 "2015-01-08T10:07:53Z")

</div>

Did you build configuration was selected as “Shipping”?  
This happened only in shipping build configuration.  
As **zql** said right there is void UGameInstance::StartGameInstance() where this params cleared for shipping build, so i just override this function.  
tnx

---

<div class="post-metadata">

**Author:** ![\_h2o](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@\_h2o](https://forums.unrealengine.com/u/_h2o)\
**Post date:** [January 8, 2015, 10:08am UTC](https://forums.unrealengine.com/t/shipping-build-do-not-accept-comand-line-arguments/302472/13 "2015-01-08T10:08:29Z")

</div>

**zql** tnx  
this was the real reason.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_890dc646](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_890dc646](https://forums.unrealengine.com/u/anonymous_user_890dc646)\
**Post date:** [January 8, 2015, 1:29pm UTC](https://forums.unrealengine.com/t/shipping-build-do-not-accept-comand-line-arguments/302472/14 "2015-01-08T13:29:22Z")

</div>

That’s cool.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_76ae4db4](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_76ae4db4](https://forums.unrealengine.com/u/anonymous_user_76ae4db4)\
**Post date:** [July 13, 2017, 1:44am UTC](https://forums.unrealengine.com/t/shipping-build-do-not-accept-comand-line-arguments/302472/15 "2017-07-13T01:44:37Z")

</div>

For anyone wanting to disable this behaviour, you can hack around it by creating a new derived class from UGameInstance inside your game project which completely overrides StartGameInstance() with the same implementation (minus the offending Tmp = TEXT(“”) line.) This works for non-source builds too, just remember to update the code again if you upgrade engine versions. If you’re lazy (like me) you can catch engine upgrades with a compile error using the following snippit somewhere inside your override of StartGameInstance(), eg. for catching upgrades from UE4.14:

```
#include "Runtime/Launch/Resources/Version.h"
...
#if ENGINE_MINOR_VERSION > 14
#error "You have upgraded from UE4.14 to a newer version. Please recreate StartGameInstance() as an exact copy of UGameInstance::StartGameInstance() and comment out the Tmp = TEXT("") line again."
#endif

```

---

<div class="post-metadata">

**Author:** ![Jason\_Hoku](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/jason_hoku/32/268033_2.png) [@Jason\_Hoku](https://forums.unrealengine.com/u/Jason_Hoku)\
**Post date:** [February 4, 2022, 10:50am UTC](https://forums.unrealengine.com/t/shipping-build-do-not-accept-comand-line-arguments/302472/16 "2022-02-04T10:50:44Z")

</div>

For people still having issues with this, I got it working by being very specific with the way I added my arguments to the server build executable:

GameBuildExecuteable-Platform-Shipping LevelName?Listen?port=9999

No spaces in between the first command line arguments, only question marks in one long string.

---

<div class="post-metadata">

**Author:** ![rever22411](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@rever22411](https://forums.unrealengine.com/u/rever22411)\
**Post date:** [May 5, 2023, 7:47am UTC](https://forums.unrealengine.com/t/shipping-build-do-not-accept-comand-line-arguments/302472/17 "2023-05-05T07:47:46Z")

</div>

How to carrectly override `UGameInstance::StartGameInstance()`?
