My game currently consists of a large town with roads and houses randomly generated by the server on start up. When a client connects to the game, the houses and roads will begin spawning like normal. At some town sizes (more houses and roads), the client does not spawn all of the objects and receives the error
“Did not find target for sync message for (some integer)”.
I know this error arises when an object on the client no longer exists yet the server tries to upkeep the SyncVars. I’ve narrowed the problem down to one script used to apply a rotation to the houses so they face roads correctly:
using UnityEngine;
using UnityEngine.Networking;
public class LotTransformSync : NetworkBehaviour
{
[SyncVar] public Quaternion syncRot;
public void SetRotation()
{
syncRot = transform.rotation;
}
public override void OnStartClient()
{
transform.rotation = syncRot;
}
}
When I omit this script from the house game object, no error occurs. Also, when i reduce the town size to something smaller than what I was hoping to have, there is no error. I don’t want to limit my game’s town size to fix the issue, because that might cause the error to randomly pop up when I add more objects to the game world.
I have channel 0 on my NetworkManger set to Reliable Sequenced, which other answers have said should fix things, but it still does not solve the issue.
Any ideas on how to fix this? Thanks in advance for the help.