I want to ask my question on this forum - maybe it's dumb, but I have trouble with understanding crucial part of game networking .
So to illustrate:
1. I have game client in Unity, where I have scene with some objects that I want to network
2. I have written in game server in C#, but not in Unity, which is mostly responsible for handling messages etc.
3. I don't use UNET, I use ENet with wrapper around it and additional functions
My question is: how to assign proper IDs to networked object which will be the same across all clients?
What I've done now is :
1. All of clients have the same Unity scene wit the same objects to network
2. In Unity client-side, each client at Start() pick all components which I want to network
3. Sort all components which compares game objects names and their parents
4. Network ID is just index in an array
And it works across all the clients, so I can send events with id only.
However I don't understand how it's done in other games with above model, or in commercial games.
What I've researched are:
1. Server spawns objects and sends message to the client "Create object of type with params .... and assign network id X"
2. Host client assigns network IDs and sends Unity scene to other clients where they load it - can they do that?
3. Server spawns all of objects
I searched around MLAPI, Mirror and other libraries and I couldn't find how it's generated.
Most of resources mention about assigning ID by server, but it doesn't fit to my model, or I don't understand how it works really.