private uLink.NetworkView Creator(string prefabName, uLink.NetworkInstantiateArgs args, uLink.NetworkMessageInfo info) { uLink.NetworkView instance; if (pool.Count > 0) { instance = pool.Pop(); args.SetupNetworkView(instance); #if UNITY_4_0 instance.gameObject.SetActive(true); #else instance.gameObject.SetActiveRecursively(true); #endif } else { instance = uLink.NetworkInstantiatorUtility.Instantiate(prefab, args); } uLink.NetworkInstantiatorUtility.BroadcastOnNetworkInstantiate(instance, info); return(instance); }
/* * private uLink.NetworkView PreInstantiator(string prefabName, Vector3 position, Quaternion rotation, uLink.BitStream stream) * { * if (Pool.Count > 0) * { * uLink.NetworkView instance = Pool.Pop(); * instance.transform.position = position; * instance.transform.rotation = rotation; * //instance.gameObject.SetActive(true); * * //Debug.Log("PreInstantiator " + instance.name); * * return instance; * } * else * { * uLink.NetworkView instance = (uLink.NetworkView)Object.Instantiate(Prefab); * instance.transform.parent = Parent; * instance.transform.position = position; * instance.transform.rotation = rotation; * * //Debug.Log("PreInstantiator " + instance.name); * * return instance; * } * } * * private void PostInstantiator(uLink.NetworkView instance, uLink.NetworkMessageInfo info) * { * instance.BroadcastMessage("uLink_OnNetworkInstantiate", info, SendMessageOptions.DontRequireReceiver); * * if(Activate != null) * Activate(instance.gameObject); * * Active.Add(instance); * } */ uLink.NetworkView Creator(string prefabName, uLink.NetworkInstantiateArgs args, uLink.NetworkMessageInfo info) { uLink.NetworkView instance = null; if (Pool.Count > 0) { instance = Pool.Pop(); args.SetupNetworkView(instance); //Debug.Log("Creator " + instance.name); } else { instance = uLink.NetworkInstantiatorUtility.Instantiate(Prefab, args); //Debug.Log("Creator " + instance.name); } uLink.NetworkInstantiatorUtility.BroadcastOnNetworkInstantiate(instance, info); if (Activate != null) { Activate(instance.gameObject); } Active.Add(instance); return(instance); }
internal static void _DoAutoSetupNetworkViewOnAwake(NetworkView nv) { if (_autoSetupOnAwake) { _autoSetupOnAwakeArgs.SetupNetworkView(nv); ClearAutoSetupNetworkViewOnAwake(); } }
private uLink.NetworkView Creator(string prefabName, uLink.NetworkInstantiateArgs args, uLink.NetworkMessageInfo info) { uLink.NetworkView instance; if (pool.Count > 0) { instance = pool.Pop(); args.SetupNetworkView(instance); SetActive(instance, true); // will trigger callback message "OnEnable" (networkView.viewID != unassigned). } else { instance = uLink.NetworkInstantiatorUtility.Instantiate(prefab, args); // will trigger callback message "Awake" and "OnEnable" (networkView.viewID != unassigned). } uLink.NetworkInstantiatorUtility.BroadcastOnNetworkInstantiate(instance, info); // will trigger callback message "OnNetworkInstantiate". return(instance); }
private uLink.NetworkView Creator(string prefabName, uLink.NetworkInstantiateArgs args, uLink.NetworkMessageInfo info) { uLink.NetworkView instance; if (pool.Count > 0) { instance = pool.Pop(); args.SetupNetworkView(instance); SetActive(instance, true); } else { instance = uLink.NetworkInstantiatorUtility.Instantiate(prefab, args); } uLink.NetworkInstantiatorUtility.BroadcastOnNetworkInstantiate(instance, info); return(instance); }