Cross-Platform Runtime Configuration Solution?

In my app I connect to a server. I’m trying to build configuration into my code right now so that I can point to a different server URL in different environments. I have looked around Google and not found anyone that specifically addresses each of the points of this problem that is important to me when it comes to configuration. Here are my requirements:

  • Runtime configuration. I want to be able to change where something is pointed after I’ve already sent the beta to a friend. I don’t want to go to all the trouble to compile and email the app to someone only to realize I gave him a version with the wrong URL in it and I don’t want to have a different copy of my executable for each server environment I have.
  • Cross-platform. I don’t want to implement a solution that won’t work for web or for mobile when I eventually move to that platform.

I notice when I compile my exe I get a Resources folder as part of the output but it looks like the resources themselves are compiled so that’s not really runtime configurable. Whereas a separate file might not be cross-platform compatible.

Appreciate any help!

Have your game contact your website on startup and ask for a URL. Your website can then reply with the URL that the user is meant to use.

So, basically move the configuration to the server. In essence my “config file” is a config service instead. I would still have a URL that needs configuring on the Unity side though. Are you suggesting this method because there isn’t a good way to do what I’m asking in Unity with a local file?

Thank you for your suggestion btw.

Graham’s suggestion is the way to go. There are plenty of ways to store config within a Unity file, but none that meet your specific requirements in the OP.

I suggested it because that’s how I’d solve the problem you started the thread with.

Thanks again Graham and MakeCodeNow.