Quick Start: Using Addressables with Pool Mini-Boss
Pool Mini-Boss is like a mini Pool Boss, that you can use to create temporary pooled prefabs. When your Pool Mini-Boss Game Object becomes enabled, it creates its items in Pool Boss, where they are usable until Pool Mini-Boss becomes disabled. It support both Addressables and traditional prefab references, but we're going to demonstrate Addressables here.
-
First, we're going to need to install and enable the Addressables package and filter. Open the Package Manager from
Window -> Package Manager
. Then wait a few seconds for all packages to load. Find the "Addressables" package and install it. -
Next, we need to enable the Addressables feature in Core GameKit so the options will be visible for you. Open the Welcome Window from
Windows -> Core GameKit -> Welcome Window
. Check the box for "Addressables" and your project will automatically recompile. Wait for it to finish, then close the Welcome Window. -
Now let's create a Pool Mini-Boss. Locate the PoolMiniBoss prefab in
Assets/Plugins/DarkTonic/CoreGameKit/Prefabs
and drag it into your Scene. -
Then, drag that Game Object in your Scene into the Project Window to create your own prefab of it, so that you won't be connected to the root source prefab anymore - that would cause you issues when you update the plugin. Finally, make sure you select the Game Object in the Hierarchy, not Project View, so we can work with it. Now the Inspector controls will appear like this, and it looks much like Pool Boss:
- Change the dropdown "Create Items As" to "Addressable" so that we can drag in Addressables to create pool items.
-
We'll need to get Addressables ready to use. Open up
Window -> Asset Management -> Addressables -> Groups
and you will see this: -
Go ahead and click that huge button, then you'll see this after a few seconds:
-
Now drag one of your game prefabs into "Default Local Group (default). That will create an Addressable from it, which shows up under it like the image below. You can close the Addressable Groups window.
-
Select PoolMiniBoss in the Hierarch again, then drag the same prefab you made an Addressable into the yellow drag area. It will create a pool item and look something like this:
-
We're going to want to fire a Custom Event when the items are created in Pool Boss, so first we'll need to create the Custom Event. Go to Pool Boss (click the Pool Boss button on the Core GameKit banner in the Inspector for a shorcut), click "Collapse All Sections", then expand "Custom Events". Create a 2nd Custom Event called "Spawn Addressable". You should then see something like this:
-
Select PoolMiniBoss again and check the 'Fire "Items Created" event' checkbox. Then click the "Add" button below that. Finally, select "Spawn Addressable" from the "All Custom Events" dropdown. Now that section should look like this:
-
That's it for Pool Mini-Boss. Now let's create a Triggered Spawner that will spawn the Addressable when the Custom Event fires. Create a new Empty Game Object called "AddressableSpawner" and add "Triggered Spawner V2" component to it. You'll see this:
- From the "Event To Activate" dropdown, select "Custom Event". Then select "Spawn Addressable" from the "All Custom Events" dropdown. Next we need to tell the Spawner what to spawn.
-
From the "Prefab Source" dropdown, select "Addressable". Now, drag the Addressable prefab into the "Prefab To Spawn Addressable" field beneath the last dropdown. It should look like this now:
- Everything's ready to go! Hit play, and your Addressable prefab should create clones under Pool Boss Game Object, and your spawner should spawn 1 of the Addressable immediately after that.
That's it for this Quick Start!