Skip to main content
6 votes
Accepted

How do I get the local player?

Currently, the best method is using NetworkClient from Mirror: using Mirror; GameObject localPlayer = NetworkClient.localPlayer.gameObject; Note that the ...
Banana's user avatar
  • 243
5 votes
Accepted

How to make an authoritative server assign turn order numbers to players once they join?

The server needs to know who is playing. The easiest way to do that is let the players report themself. When your game gets bigger, games usually use google, facebook or some custom login for telling ...
Zibelas's user avatar
  • 4,346
2 votes
Accepted

Synvar not syncing when Instantiating gameObject

I found a workaround using netIds. I think the problem was that when I tried to sync the gameobject, it wasn't spawned yet on the client, so it was null. ...
ToltottKaposzta's user avatar
1 vote
Accepted

Compiling Unity to WebGL gives a Node ESM module error

I fixed it by removing "type": "module" from my home directory's package.json. I'm guessing it had something ...
kalilamodow's user avatar
1 vote

How to mirror card placement over network

This is a rather simple solution for 2 players, but can be used for any number of players with a small tweak. Alice and Bob are playing. The game logic states: Alice got a card. This card arrives with ...
Zibelas's user avatar
  • 4,346
1 vote

How to reconnect a client to a match (not the server)

It is a while since I made a reconnect with Mirror, here is roughly what I did: The server is storing a map of the players authetication as key, the value is everything that was tied to the player (...
Zibelas's user avatar
  • 4,346
1 vote

How to change player objects when switching scenes?

Had the same issue. You will have to get a networkbehaviour on your player with GetComponent and take the ...
Camo's user avatar
  • 11
1 vote
Accepted

Mirror/Unet, RegisterSpawnHandler throws invalid asset Id error because assetId is 0 for dynamically loaded assetbundles

Didn't really solve this particular problem, but found a much nicer working workaround. Created a Dummy prefab with my vehicle's netcode attached to it(Note, I separated vehicle physics code and ...
Nick's user avatar
  • 561
1 vote

Unity Multiplayer Sync Bools

I solved the problem by calling the initial OnTriggerEnter event only on the server. The server changes the state for itself, and then for the player.
aleqkzander's user avatar
1 vote
Accepted

Getting XR Grabbable items networked with Unity

I have currently created a workaround but to be honest I'm not sure if this will break other aspects of the grab system. I got this working by disabling the reparenting of the object (with a bool) in ...
Richard Muthwill's user avatar
1 vote
Accepted

Mirror Create Player From Client and Change Scene

You will need a custom NetworkManager and just handle the spawning/ setting there. But keep in mind if you trust the client with the players data, it is open to manipulation. ...
Zibelas's user avatar
  • 4,346
1 vote
Accepted

Why players who join late can't see other people data?

Do not use NAME and name, it makes things confusing and you might write to the wrong variable at times. Give it more fitting ...
Zibelas's user avatar
  • 4,346
1 vote

Unity 3D mirror, sync player spawn name

welcome to the GameDev Stack Exchange. It looks like your code currently only runs server side which is pretty normal for most projects when initially creating players and setting up the scene. This ...
Benjamin Danger Johnson's user avatar
1 vote

Unity 3D mirror, sync player spawn name

You can use a syncVar for the player name. [SyncVar] public string playerName; You have to set the playerName on the server. The clients will automatically get ...
kyu's user avatar
  • 35
1 vote
Accepted

Synchronize running code over the network Unity

What you're describing is "determinism" - this is the situation where two instances of your program can independently arrive at the same outcome, consistently, given the same input. ...
DMGregory's user avatar
  • 135k

Only top scored, non community-wiki answers of a minimum length are eligible