Say I have follow code for communication(Server spawns the object, and tells client to spawn the object too):
///
/// tell client we have spawned a player.
///
///
private void AckClientSpawnPlayer(uint groupID, uint uniqueID, NetworkConnection conn)
{
GameObject entity = null;
// we generate a 3D Object when somebody logs in.
entityManager.GetPoolItem(characterID).InstantiateFromPool(spawnManager.Spawn(), Quaternion.identity, out entity);
// add connection on that network object(network base player connection)
Debug.Log("Add player for connection: " + conn + " entity null: " + (entity== null));
NetworkServer.AddPlayerForConnection(conn, entity, 0);
// send custom spawn message to our group.
S2CSpawnEntity msg = new S2CSpawnEntity();
msg.groupID = groupID;
msg.uniqueID = uniqueID;
msg.position = entity.transform.position;
msg.rotation = entity.transform.eulerAngles;
NetworkMessageExtension.SentToClientGroup(multiSessionModel.GetConnectionWithinGroup(groupID), msg, 1);
}
However, I spawn the exact same assetID object in Client, both have NetworkIdentity, would they just automatically connect and talk to eachother? Because using HLAPI’s NetworkServer.Spawn(obj) I am sure they are doing something internal things. But if I just instantiate a prefab in client with same networkIdentity, how can I make sure they can communicate with eachother in LLApi?
I debug.log all the server spawned netid for different network identities, but some of them are same, how were they still able to communicate to the right scripts between server and client.