BeardedManStudios.Network.NetworkingManager.PullObject C# (CSharp) Method

PullObject() public method

Get a game object of a given name in the NetworkingManager
public PullObject ( string name, string fallback = "" ) : GameObject
name string Name of the game object to pull
fallback string
return UnityEngine.GameObject
		public GameObject PullObject(string name, string fallback = "")
		{
			if (name == fallback)
				fallback = string.Empty;

			foreach (GameObject obj in networkInstantiates)
				if (obj.name == name)
					return obj;

			GameObject find = Resources.Load<GameObject>(resourcesDirectory + "/" + name);

			if (find == null)
			{
				if (!string.IsNullOrEmpty(fallback))
					return PullObject(fallback);
				else
					Debug.LogError("GameObject with name " + name + " was not found in the lookup. Make sure the object is in the resources folder or in the Networking Manager \"Network Instantiates\" array in the inspector.");
			}

			return find;
		}