BeardedManStudios.Network.Networking.Instantiate C# (CSharp) Метод

Instantiate() публичный статический Метод

Instantiate an object on the network
public static Instantiate ( GameObject obj, NetworkReceivers receivers = NetworkReceivers.All, Action callback = null ) : void
obj UnityEngine.GameObject Object to be instantiated by object name
receivers NetworkReceivers Recipients will receive this instantiate call (Default: All)
callback Action
Результат void
		public static void Instantiate(GameObject obj, NetworkReceivers receivers = NetworkReceivers.All, Action<SimpleNetworkedMonoBehavior> callback = null)
		{
			if (!NetworkingManager.IsOnline)
			{
				// JM: offline fixes
				SimpleNetworkedMonoBehavior snmb = (GameObject.Instantiate (obj) as GameObject).GetComponent<SimpleNetworkedMonoBehavior> ();
				snmb.OfflineStart ();
				try{
					callback(snmb);
				}catch{

				}
				return;
			}

			if (NetworkingManager.Instance == null || !NetworkingManager.Instance.IsSetup)
			{
				NetworkingManager.setupActions.Add(() =>
				{
					Instantiate(obj, receivers, callback);
				});
			}
			else
				CallInstantiate(obj.name, receivers, callback: callback);
		}

Same methods

Networking::Instantiate ( GameObject obj, Vector3 position, Quaternion rotation, NetworkReceivers receivers = NetworkReceivers.All, Action callback = null ) : void
Networking::Instantiate ( string obj, NetworkReceivers receivers, Action callback = null ) : void
Networking::Instantiate ( string obj, Vector3 position, Quaternion rotation, NetworkReceivers receivers, Action callback = null ) : void