private static bool ValidateNetworkedObject(string name, out SimpleNetworkedMonoBehavior netBehavior)
{
netBehavior = null;
if (NetworkingManager.Instance == null)
{
Debug.LogError("The NetworkingManager object could not be found.");
return false;
}
GameObject o = NetworkingManager.Instance.PullObject(name);
if (o == null)
return false;
netBehavior = o.GetComponent<SimpleNetworkedMonoBehavior>();
if (netBehavior == null)
{
Debug.LogError("Instantiating on the network is only for objects that derive from BaseNetworkedMonoBehavior, " +
"if object does not need to be serialized consider using a RPC with GameObject.Instantiate");
return false;
}
return true;
}