Exemplo n.º 1
0
        /// <summary>
        /// Initialization called by PoolManager on runtime created pools.
        /// </summary>
        public void Awake()
        {
            //can't initialize without prefab
            if (prefab == null)
            {
                return;
            }

            //add this pool to the PoolManager dictionary
            PoolManager.Add(this);

            PreLoad();
        }
Exemplo n.º 2
0
        /// <summary>
        /// Initialization called by PoolManager on runtime created pools.
        /// </summary>
        public void Awake()
        {
            //can't initialize without prefab
            if (prefab == null)
            {
                return;
            }

            //add this pool to the PoolManager dictionary
            PoolManager.Add(this);

            //for networked synced pools: get the network identity,
            //register with the Unity Networking spawning system
            NetworkIdentity networkPrefab = prefab.GetComponent <NetworkIdentity> ();

            if (networkPrefab != null)
            {
                ClientScene.RegisterSpawnHandler(networkPrefab.assetId, OnSpawn, Despawn);
            }

            PreLoad();
        }