11using System . Collections . Generic ;
22using UnityEngine ;
33using Object = UnityEngine . Object ;
4- #if MIRAGE
4+ using System ;
5+ #if ! MIRROR
56using Mirage ;
67#else
78using Mirror ;
8- using System ;
99#endif
1010
1111namespace Object_Pooler
@@ -14,7 +14,7 @@ public class ObjectPoolingManager : MonoBehaviour
1414 {
1515 #region Fields
1616
17- #if MIRAGE
17+ #if ! MIRROR
1818 private ServerObjectManager _serverObjectManager ;
1919 private readonly Dictionary < int ? , NetworkIdentity > _objectsAssetIds = new Dictionary < int ? , NetworkIdentity > ( ) ;
2020#else
@@ -32,7 +32,7 @@ private void Start()
3232 {
3333 _parent = new GameObject { name = "Pooled Objects" } ;
3434 DontDestroyOnLoad ( _parent ) ;
35- #if MIRAGE
35+ #if ! MIRROR
3636 _serverObjectManager = FindObjectOfType < ServerObjectManager > ( ) ;
3737
3838 ClientObjectManager clientObject = FindObjectOfType < ClientObjectManager > ( ) ;
@@ -59,7 +59,7 @@ private void Start()
5959
6060 #region Custom Spawn Handlers
6161
62- #if MIRAGE
62+ #if ! MIRROR
6363 /// <summary>
6464 /// Spawn handler for all network spawning of things.
6565 /// </summary>
@@ -76,7 +76,7 @@ internal NetworkIdentity SpawnObject(SpawnMessage msg)
7676 internal GameObject SpawnObject ( Vector3 position , Guid assetId )
7777#endif
7878 {
79- #if MIRAGE
79+ #if ! MIRROR
8080 NetworkIdentity spawnedObject = NetworkSpawnPool ( msg . position , Quaternion . identity , msg . prefabHash , 1 ) ;
8181#else
8282 NetworkIdentity spawnedObject = NetworkSpawnPool ( position , Quaternion . identity , assetId , 1 ) ;
@@ -86,7 +86,7 @@ internal GameObject SpawnObject(Vector3 position, Guid assetId)
8686 spawnedObject . gameObject . SetActive ( true ) ;
8787
8888 // return the game object back to mirage to have it finish spawning.
89- #if MIRAGE
89+ #if ! MIRROR
9090 return spawnedObject ;
9191#else
9292 return spawnedObject . gameObject ;
@@ -97,7 +97,7 @@ internal GameObject SpawnObject(Vector3 position, Guid assetId)
9797 /// Spawn handler for all network unspawning of things.
9898 /// </summary>
9999 /// <param name="spawned">What network identity we are going to unspawn and return back to network pool.</param>
100- #if MIRAGE
100+ #if ! MIRROR
101101 internal void UnSpawnObject ( NetworkIdentity spawned )
102102#else
103103 internal void UnSpawnObject ( GameObject spawned )
@@ -113,7 +113,7 @@ internal void UnSpawnObject(GameObject spawned)
113113
114114 break ;
115115 }
116- #if MIRAGE
116+ #if ! MIRROR
117117
118118 p . Despawn ( spawned ) ;
119119#else
@@ -141,9 +141,9 @@ private void UnSpawnObject<T>(T spawned) where T : Object
141141 p . Despawn ( spawned ) ;
142142 }
143143
144- #endregion
144+ #endregion
145145
146- #region Network Spawning
146+ #region Network Spawning
147147
148148 /// <summary>
149149 /// Spawn an object using our pooled objects for the specific object
@@ -154,7 +154,7 @@ private void UnSpawnObject<T>(T spawned) where T : Object
154154 /// <param name="AssetId">The asset id of the object from <see cref="NetworkIdentity" /> to use to spawn object of.</param>
155155 /// <param name="quantity">How many pooled objects we want to create of this object. If we don't have a pool started.</param>
156156 /// <returns></returns>
157- #if MIRAGE
157+ #if ! MIRROR
158158 public NetworkIdentity NetworkSpawnPool ( Vector3 position , Quaternion rotation , int ? AssetId , int quantity = 3 )
159159#else
160160 public NetworkIdentity NetworkSpawnPool ( Vector3 position , Quaternion rotation , Guid AssetId , int quantity = 3 )
@@ -186,7 +186,7 @@ public void NetworkUnSpawnObject(NetworkIdentity objectSpawned, bool isServer)
186186 {
187187 UnSpawnObject ( objectSpawned ) ;
188188
189- #if MIRAGE
189+ #if ! MIRROR
190190 // If this is network server then tell rest of clients to unspawn object.
191191 if ( _serverObjectManager == null || ! isServer ) return ;
192192
0 commit comments