How to get unique id for launch argument of GameLift server process?

Hi, I have a question how to get unique id for launching argument of server process.

This is need to modifying AssetBundle cache path and Log path for Unity3d server process. Unity’s AssetBundle caching system doesnt provide multi-instance accessing, so it needs to be specified unique path, also this is same to logging. GameLift CSharp SDK used log4net internally and it’s logger is created before the server process getting GameSessionId. So I can’t use game session id for this purpose. Is there any features for providing unique id before calling InitSDK()?

My idea is that using randomized id for this purpose, but I want to know any other method.

Thanks.

Theres a number of things you can do, for example:

  • You can assign your process random UUID, some chance of collision but depending on the library this would be extremely low
  • You can grab the process id at startup and use that.
  • You can pass in an identifier with the configuration for each process via the runtime configuration, process then gets passed this in its args. The same way you set up a port for multi-process.
    You can then set-up your logs/directory related to this id and then calls ProcessReady with the process specific log paths etc.

Thanks for reply. If I configure multiple process launch setup for fleet, how GameLift re-launch when the specific process is ended? In example:

/path/to/serverapp.exe --cachepath=/path1 // process 1

/path/to/serverapp.exe --cachepath=/path2 // process 2

/path/to/serverapp.exe --cachepath=/path3 // process 3

In this case, if process 2 is terminated, can GameLift re-launch (recycle) process 2 with same parameter (–cachepath=/path2) ?

Edit: I tested above case and found that GameLift automatically recycle process with exactly same parameters.