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

Instantiate() public static method

This is the main instantiate method that is proxyed through the Networking.Instantiate method
public static Instantiate ( NetworkReceivers receivers, string obj, Vector3 position, Quaternion rotation, int callbackCounter ) : void
receivers NetworkReceivers The receivers that will get this instantiate command
obj string The name of the object that is to be instantiated
position Vector3 The position where the object will be instantiated at
rotation UnityEngine.Quaternion The rotation that the object will have when instantiated
callbackCounter int The id for the callback that is to be called when this object is instantiated
return void
		public static void Instantiate(NetworkReceivers receivers, string obj, Vector3 position, Quaternion rotation, int callbackCounter)
		{
			ulong uniqueId = 0;

			if (!TryPullIdFromObject(obj, ref uniqueId))
				return;
			
			if (Instance != null && Instance.OwningNetWorker != null)
				Instance.RPC("NetworkInstantiate", receivers, Instance.OwningNetWorker.Uniqueidentifier, Instance.OwningNetWorker.IsServer ? uniqueId : 0, obj, position, rotation, callbackCounter);
			else
			{
				setupActions.Add(() =>
				{
					Instance.RPC("NetworkInstantiate", receivers, Instance.OwningNetWorker.Uniqueidentifier, Instance.OwningNetWorker.IsServer ? uniqueId : 0, obj, position, rotation, callbackCounter);
				});
			}
		}