After I changed the min player count to 1. I try to test on the Unity play mode. In the main menu, I click on the Find Match button. It appears to switch scenes for a moment, but it crashes and I get
NotServerException: Destroy a spawned NetworkObject on a non-host client is not valid. Call Destroy or Despawn on the server/host instead.
Unity.Netcode.NetworkObject.OnDestroy () (at ./Library/PackageCache/com.unity.netcode.gameobjects@1.2.0/Runtime/Core/NetworkObject.cs:440)
I can’t even figure out which Network Object the code would be trying to destroy. It happens just as the scene changes from Main Menu to Game. I’ve been following the code along the way. I tried deactivating all the network objects in Game just to see if that might change the behavior (CoinSpawner, RespawnHandler, GameHUD, the HealingZones) Didn’t change anything.
I checked again. I got the build and the editor to play together with the build hosting and the editor being a client. The build also crashed when attempting to connect to the server.
This is the console when it runs.
Oof not a lot of information this error is giving you (shakes fist at Unity).
Looking at your hierarchy, I am seeing two application controllers and networking managers, both of which should be singletons, so that might be your issue there.
Do you have network managers or application controllers present in multiple scenes?
My theory would be it’s trying to clean up extra instances of those classes, and it’s throwing the error when the client tries to delete one of them.
Oof is right… I did finally figure it out. I had missed flipping a boolean. Once I added the “!” it finally worked. Missing it meant the server was in the wrong scene when the connection was made.