Did not find target warning when using uNet

Hi everybody,

I’m new to uNet and I’m having issues synching up the client and the server. I’m using a matchManager script to parse communication between server and clients. It is a scene object that exists only in the host (using the NetworkIdentity’s “Server Only”) and it handles the Command and RPCCallback methods.

The problem is that it is only communicating correctly with the host, not on the clients. I don’t get any errors, but when using the editor as a client I get a “Did not find target for sync message for 1” warning and 2 “Did not find target for RPC message for 1” warnings. I honestly am not sure what these mean, or how to begin debugging for them, and I couldn’t find references to these warnings in the documentation. Could anyone please point me in the right direction? In advance, thank you.

The code is below:

using UnityEngine;
using UnityEngine.Networking;
using System.Collections;

public class MatchManager : NetworkBehaviour {

	/***************************************************
	 * This class controls the state of a match; this 
	 * includes the player health, the phase each player 
	 * is in and what cards were sent to each other
	 * it only runs on the host
	 * ************************************************/
	 [SyncVar] public Turn_Manager turnManagerPlayerOne;
	 [SyncVar] public Turn_Manager turnManagerPlayerTwo;

	public bool waitForPlayerFlag = false;

	[Command]
	public void CmdSetPlayer(int _playerID, GameObject _matchManagerGO)
	{
		// get the appropriate turnmanager
		var _turnManager = _matchManagerGO.GetComponent<PlayerNetworkSetUp>().GetTurnManager ();
		// if the id is 0, then its the host
		if (_playerID == 0) {
			turnManagerPlayerOne = _turnManager;
		// if not its the second player
		} else if (_playerID == 1) { 
			turnManagerPlayerTwo = _turnManager;
		// if there's no one, there is an error
		} else {
			Debug.LogError ("there is no such thing as a player " + _playerID);
		}
	
		// if we are not already waiting, start waiting
		if(!waitForPlayerFlag)
			StartCoroutine ("WaitForTwoPlayers");
	}

	IEnumerator WaitForTwoPlayers()
	{
		// set the waiting flag
		waitForPlayerFlag = true;

		// while enabled
		while (this.enabled) {
			// if we don't have both players keep waiting
			if (turnManagerPlayerOne != null && turnManagerPlayerTwo != null) {
				
				Debug.Log ("we have two players");
				RpcSetPlayerOneTurnPhase(Turn_Manager.TurnPhase.ForgePhase);
				RpcSetPlayerTwoTurnPhase(Turn_Manager.TurnPhase.ForgePhase);
				break;
			} else {
				yield return new WaitForEndOfFrame();
			}


		}// end while
	}//end coroutine

	[ClientCallback]
	[ClientRpc]
	void RpcSetPlayerOneTurnPhase( Turn_Manager.TurnPhase _newPhase)
	{
			Debug.Log("sending instruction to player one to go to "+_newPhase);
			turnManagerPlayerOne.SetCurrentTurnPhase (_newPhase);
	}

	[ClientCallback]
	[ClientRpc]
	void RpcSetPlayerTwoTurnPhase( Turn_Manager.TurnPhase _newPhase)
	{
			Debug.Log("sending instruction to player two to go to "+_newPhase);
			turnManagerPlayerTwo.SetCurrentTurnPhase (_newPhase);
	}
}

The CmdSetPlayer method is called from playerNetworkSetupScript.

I’d guess that the issue is that this object exists only on the server. Whenever it tries to sync the value of one of its SyncVars or call an Rpc, it tries to find the matching object on the client, but that object doesn’t exist. Ultimately, giving an object SyncVars or synchronized function calls and then making it exist only on the server kind of work at cross-purposes. Given what you’re trying to do, you’re probably best off unchecking the “Server Only” box on this object.

For anyone having the same error but the solution doesn’t work:


I had two NetworkTransformChild components that tried to access two disabled GameObjects. Be sure that every enabled network component is able to access their specified gameobject/component

Is there a way to know what something is trying to access, or to see what things netid’s are?