简体   繁体   中英

How set default command line parameters in linux build on Unity

I have some problems with local on Linux.

Problem fixes when I run build with "LANG=C" problem fixes.

How can I set this parameter as a default parameter in Linux build?

I can think of two ways to do this off of the top of my head.

Batch Launching

The first would be to simply create a shell script (either a batch file on Windows or bash on Linux, or whatever the equivalent is for your target platform) that launches the default program with the provided arguments; then treat the launcher script like the default program so no one gets confused.

Some DDS services, like Steam, allow for custom launch arguments, so you might want to append the call with $@ to add all arguments to the end.

So your batch launcher would just contain something like

LANG=C ./my_game_name.x86 $@

It's worth noting that I've heard of this problem before, generally in non-English locales, and LC_ALL=C is also considered important. I can't advise on why, though. That would make it more like:

LC_ALL=C LANG=C ./my_game_name.x86 $@

Custom Launcher

The other option is much the same, but via an executable file, likely written in C# (since you're already using Unity), that runs the program with the default option. As an reasonably-old-school Linux user I find it against my liking, but there's a decent example at https://loune.net/2017/06/running-shell-bash-commands-in-net-core/ . You would likely need to compile it for Linux through Visual Studio.

The same can be said for more platform-agnostic languages like Python or Ruby. I prefer batch launching because it cuts-to-the-chase.

Just make sure your launcher is marked as executable with chmod u+x ./launcher_name

It is likely that Unity has some way of setting this as a default, but I've found no reference to it yet and I know games have been published in the past with this exact method.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM