Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: Updating, changing, or downgrading your SpacetimeDB package requires that you remove and re-add your SpacetimeDBNetworkManager #217

Open
cloutiertyler opened this issue Jan 14, 2025 · 0 comments
Assignees

Comments

@cloutiertyler
Copy link
Collaborator

Reproduction Steps

If you create a new project (or follow the Blackhol.io tutorial) in Unity and and you install the SpacetimeDB SDK unity package with:

https://github.com/clockworklabs/com.clockworklabs.spacetimedbsdk.git

Then you add the SpacetimeDBNetworkManager to an GameObject in the scene, as directed, you will be able to connect to SpacetimeDB.

If you then remove the SpacetimeDB SDK unity package and re-add it with the same URL:

https://github.com/clockworklabs/com.clockworklabs.spacetimedbsdk.git

Rebuild and run, it will also work fine.

But if you then remove the SpacetimeDB SDK unity package and re-add it with a different version, e.g.:

https://github.com/clockworklabs/com.clockworklabs.spacetimedbsdk.git#phoebe/subscribe-to-all-tables

Rebuild and run (you need to fix a compiler error for this particular branch), it will not work. You will be able to connect, but the OnConnect callback will never be called.

Furthermore, if you revetr to using the original URL, it will also not work in the same way:

https://github.com/clockworklabs/com.clockworklabs.spacetimedbsdk.git

NOTE! I was not able to reproduce this reliably, it only happened once for me. As a result, I think it should be a P2 or lower.

Workaround

If you remove and re-add the SpacetimeDBNetworkManager to your game object in the scene, it will again begin working.

Potential Issue and Fix

Currently we do a dance with SpacetimeDBNetworkManager._instance. Based on print statements, I suspect somehow the SpacetimeDBNetworkManager._instance that the Build function referenced was in a different DLL than the SpacetimeDBNetworkManager._instance that was in the scene. Some C# module resolution issue.

Perhaps we could not have a global and for the Unity version just have you add the DbConnection explicitly in your own code which you know for sure references the right instance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants