Update Photon Bolt Settings from InitializeOnLoad

Hello!

I have found that sometimes when Unity crashes, my Bolt Settings are reverted back to default. I have also found that Unity Cloud Build does not contain my Bolt Settings and so everything there is in default mode as well.

Is it possible to change the Bolt Settings from an InitializeOnLoad static class so that I don't have to worry about either of these things occurring? If I could have Unity automatically check if Bolt has the proper settings when it loads, and change things if it doesn't it would smooth out my workflow a ton.
If I could start using Unity Cloud Build to build all my different deployments that would be amazing as well.

I have found the BoltRuntimeSettings class, and I have found the BoltConfig class, but I am not sure how to forcibly update the BoltConfig of the BoltRuntimeSettings.

Any pointers would be appreciated, thank you!

- Sterling Long!

Comments

  • Hello @Luzzotica ,

    First, just make sure you have included the "BoltRuntimeSettings" into your version control system.
    If you are using Git, you can just call "git add -f Assets\Photon\PhotonBolt\resources\BoltRuntimeSettings.asset" and it should be included in Stage for commit.

    As you already find out, you can modify most of the settings via code by just looking at "BoltRuntimeSettings.instance", and to modify the "BoltConfig", you will need a copy, that you can get at "BoltRuntimeSettings.instance.GetConfigCopy()".

    You can't modify the values from the serialized "BoltConfig" directly, only via the UI.

    Also, please, take a look here: https://doc.photonengine.com/en-US/bolt/current/troubleshooting/faq#how_to_change_the_bolt_default_configuration_using_code_

    You can also use something like this:
    private BoltConfig Setup()
    {
    	var settings = BoltRuntimeSettings.instance;
    
    	// change settings
    
    	var config = settings.GetConfigCopy();
    
    	// change config
    
    	return config; // Use config when starting Bolt
    }
    

    --
    Ramon Melo
    Photon Bolt Team