Start button not being active

I’ve launched the menu and every time i host a lobby, the start button does not become active.
I even went into the code and added debugs for the methods and
OnServererAddPlayer isnt called when the lobbys starts.
neither does OnServerConnect.

What am i missing here

Hi there, are you hosting in a build or in the editor? Is your second player joining from the build or the editor?

Is AuthorityHandlePartyOwnerStateUpdated getting called in the RTS Player on the host? That looks to be the initial trigger for showing the start button.

I’ve tried editor host and build join and build host and editor join.
I checked AuthorityHandlePartyOwnerStateUpdated. It is not being called.

Okay let’s follow that line of thought.
AuthorityHandlePartyOwnerStateUpdated is triggered by a syncVar hook, so first thing is to check that the hook is setup correctly. Make sure that is spelled correctly and everything.

[SyncVar(hook = nameof(AuthorityHandlePartyOwnerStateUpdated))]
private bool isPartyOwner = false;

Next, make sure that value is being updated correctly to trigger the hook. So in the OnServerAddPlayer method in the RTSNetowrkManager, check that it has the line at the end:
player.SetPartyOwner(Players.Count == 1);

Should have that double equation to make sure player 1 is always the host and has access to the start button.

Let me know if that is all correct.

Side note, does your OnClientConnect() include the base.OnClientConnect()?

SyncVar and SetPartyOwner are correct. OnClientConnect() does include base.OnClientConnect().

So onServerAddPlayer is the next up the chain, which is what you said. That is being called by Mirror, so it shouldn’t be affected by your code. Are there any errors in the console?

Can you see your players being instantiated in the hierarchy in the editor? Is your player prefab setup correctly in the network manager in your menu scene, and included under registered spawnable prefabs?

What version of Unity and Mirror are you using?

Hey there, did you ever figure this out? Do you want to upload a version of your project for me to look at?

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.

Privacy & Terms