SDK update guide

Any new version of coherence should install automatically in the Unity Editor's Package Manager. To check the version, open up coherence > coherence Hub and the version should be displayed at the top.

General updates

  • After an SDK upgrade, bake process will be initiated automatically by the SDK to make sure the baked scripts are up to date.

  • If you were using the old manual code generation system and you run into any compilations or runtime errors in coherence code after the update, you need to delete Assets/coherence/baked folder. These steps might help resolve the issue:

If you were using an old code generation system and you run into any compilation or runtime errors in coherence code after the update, you need to delete Assets/coherence/baked folder and these steps might help resolve the issue:

1) Go to coherence > Bake

This will generate baked skeleton scripts which will compile but not work at runtime. If you still have compilation errors at this point, it's better to go into Safe mode and fix possible API upgrade issues, as detailed below, in the second part of this article.

2) Go to Project settings > coherence > Gather Schema to fully generate the baked code (this can also be done via any of the other baking options). After that click Project settings > coherence > Bake.

3) This process should handle old bindings which are different from the updated version. If the errors persist, check the bindings window for the relevant Prefab to make sure they are set up properly. Then perform steps 1 and 2 again. This also makes sure old baked components are removed (these are now added at runtime).

The 0.9 version introduces two new features:

  • You can update your CoherenceSync prefabs outside the Resources folder and use PrefabMapper.

  • Source Generator system is introduced for Baking. You can read more on it here.

SDK Upgrade 0.7.x (0.8.x) -> 0.9.0

  • Notable API changes include:

  1. Coherence.Network is removed now. OnConnected and OnDisconnected events are moved to IClient and have changed a signature:

        private void OnEnable()
        {
            if (!MonoBridgeStore.TryGetBridge(gameObject.scene, out CoherenceMonoBridge monoBridge))
                return; 
            
            client = monoBridge.Client;
            client.OnConnected += OnConnect;
            client.OnDisconnected += OnDisconnect;
        }
    
        private void OnDisable()
        {
            client.OnConnected -= OnConnect;
            client.OnDisconnected -= OnDisconnect;
        }
    
        private void OnConnect(ushort u)
        {
            onConnect.Invoke();
        }
    
        private void OnDisconnect(ConnectionCloseReason reason)
        {
            onDisconnect.Invoke();
        }

2. MonoBridgeStore.GetBridge is now obsolete, and will be replaced with MonoBridgeStore.TryGetBridge.

MonoBridgeStore.TryGetBridge(gameObject.scene, out monobridge);

3. CoherenceSync.isSimulated is now obsolete, and will be replaced with CoherenceSync.HasStateAuthority.

4. CoherenceSync.RequestAuthority is now obsolete, and will be replaced with CoherenceSync.RequestAuthority(AuthorityType).

For more information, see Release Notes.

For detailed documentation of the updated CoherenceSync component, see CoherenceSync.

CLI Tools

The CLI tools have been updated, especially the ones that handle Simulators. To learn more about this, see CLI utilities.

Last updated