void OnGUI() { if (isServer) { if (GUILayout.Button("Spawn 1")) { NetworkObjectPoolManager.PullObject("Object1").transform.position = new Vector3(m_Position++, 0, 0); } if (GUILayout.Button("Spawn 2")) { NetworkObjectPoolManager.PullObject("Object2").transform.position = new Vector3(m_Position++, 0, 0); } } }
void OnGUI() { NetworkIdentity nId = GetComponent <NetworkIdentity>(); if (nId && nId.isServer) { if (GUILayout.Button("Spawn 1")) { ObjectPoolManager.PullObject("Object1").transform.position = new Vector3(m_Position++, 0, 0); } if (GUILayout.Button("Spawn 2")) { NetworkObjectPoolManager.PullObject("Object2").transform.position = new Vector3(m_Position++, 0, 0); } } }
void Start() { if (isServer) { m_Instance = this; if (GameObject.FindObjectsOfType(this.GetType()).Length > 1) { Debug.LogError("Can't have more than one Object Pool Manager in a scene."); } for(int i = 0; i < ObjectPoolStartAmounts.Count; ++i) { m_ObjectPoolDictionary.Add(ObjectPoolNames[i], null); m_ObjectPoolDictionary[ObjectPoolNames[i]] = new NetworkGameObjectPool(); for (int j = 0; j < ObjectsToPool[i].InnerList.Count; ++j) { m_ObjectPoolDictionary[ObjectPoolNames[i]].AddSource(ObjectsToPool[i].InnerList[j], ObjectPoolStartAmounts[i].InnerList[j]); } } } }
void Start() { if (isServer) { m_Instance = this; if (GameObject.FindObjectsOfType(this.GetType()).Length > 1) { Debug.LogError("Can't have more than one Object Pool Manager in a scene."); } for (int i = 0; i < ObjectPoolStartAmounts.Count; ++i) { m_ObjectPoolDictionary.Add(ObjectPoolNames[i], null); m_ObjectPoolDictionary[ObjectPoolNames[i]] = new NetworkGameObjectPool(); for (int j = 0; j < ObjectsToPool[i].InnerList.Count; ++j) { m_ObjectPoolDictionary[ObjectPoolNames[i]].AddSource(ObjectsToPool[i].InnerList[j], ObjectPoolStartAmounts[i].InnerList[j]); } } } }