hello,
I am using Mirror for multiplayer. I create a grid based map and navmesh OnServerReady callback.
On host side all looks and works fine.
On client side map has been generated but not parented to the right object and navmesh hasnt been generated.
so, how can i update a navmesh over mirror?
As a general rule, assume that things you do on the server do not affect clients. You have to call RPCs and make the clients run code to do whatever needs to be done. There are default components to help you/make it easy for the transform positions, rotations, and simple variables, but most everything else needs to be done on your own.
If you generate a navmesh on the server, you will need to call an RPC for the clients and do the same code again. If the server will periodically change the navmesh, then you need to think of a system that will communicate those changes to the clients so they can reproduce what changes you made to the navmesh. Maybe you will send some array of bytes to the client, or array of Vectors, it will be up to you to figure that out and communicate it to the clients. Naturally if it’s happening a lot, you need to do it efficiently so you may want to send small deltas of the changes and not the entire navmesh each time.
One of the simplest ways of handling this, is to just mimic everything on every client that affects NavMesh and have all the clients updating their navmesh. If someone does something that changes the navmesh, communicate that action to everyone and run code necessary to change the navmesh - so rather than figuring out your own system to communicate bytes/vectors in some way (low level design) you can just communicate the action performed and reproduce the effect of that action using the same code on every machine (high level design).