The ClientScene class has a static property called localPlayer of type NetworkIdentity. All Components in Unity have gameObject as property which refers to the GameObject they're attached to.
So in order to get the localPlayer object you would do:
GameObject localPlayer = ClientScene.localPlayer.gameObject;
Note that in more recent development,...
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 vehicle input netcode, left physics code on vehicle object where it belongs). Saved this dummy as an asset, added NetworkIdentity component to it and added it into ...
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.
public class BasicNetwork: NetworkManager
public override void OnServerAddPlayer(NetworkConnection conn)
Transform startPos = GetStartPosition();
Do not use NAME and name, it makes things confusing and you might write to the wrong variable at times. Give it more fitting names, like playerName, localName, nameToUpdate or similar. All caps is usually used for constants.
Your SendPlayerNameToServer is using wrong naming, since it is a Command, it has to start with Cmd for Mirror to work correctly. ...
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 should keep your server up to date with the latest information, however it does not send these updates to clients.
Usually when setting shared variables you need ...
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.
Determinism will not solve your problem here, because you do not have the same input.
The copy of your game running on the player's computer (the client) knows what ...