x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Shipping build do not accept comand line arguments

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?

Product Version: Not Selected
Tags:
more ▼

asked Dec 26 '14 at 06:40 AM in Bug Reports

avatar image

_h2o_
94 9 15 24

avatar image Tim C ♦♦ STAFF Jan 06 '15 at 03:36 PM

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?

avatar image _h2o_ Jan 08 '15 at 10:07 AM

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

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

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.

more ▼

answered Dec 26 '14 at 10:16 AM

avatar image

zql
196 7 22 21

avatar image _h2o_ Dec 26 '14 at 12:06 PM

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.

avatar image zql Dec 26 '14 at 03:50 PM

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?

avatar image zql Dec 26 '14 at 04:12 PM

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.

avatar image _h2o_ Dec 26 '14 at 04:21 PM

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

avatar image zql Dec 26 '14 at 04:33 PM

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.

avatar image _h2o_ Dec 27 '14 at 10:31 AM

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

avatar image zql Dec 27 '14 at 11:11 AM
    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.    
   
avatar image zql Dec 27 '14 at 11:54 AM

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.

avatar image _h2o_ Jan 08 '15 at 10:08 AM

zql tnx this was the real reason.

avatar image zql Jan 08 '15 at 01:29 PM

That's cool.

avatar image sds-michael Jul 13 '17 at 01:44 AM

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
(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question