raymond
Junior Member
Posts: 53
Posts: 53
|
Post by raymond on Mar 19, 2024 16:48:56 GMT
Hello,
I would like to spawn from the prefabs pool using script but can not find any documentation on it.
Thank you,
Raymond
|
|
|
Post by DarkTonic Dev on Mar 19, 2024 17:54:10 GMT
|
|
raymond
Junior Member
Posts: 53
Posts: 53
|
Post by raymond on Mar 19, 2024 18:56:24 GMT
My mistake, I do mean "Prefab Pools", I can switch forums if you want.
I know how to utilize "Prefab Pools" through the inspector but can I also access "Prefab Pools" via script so I can spawn from it through scripting.
Thanks
|
|
|
Post by DarkTonic Dev on Mar 19, 2024 19:04:28 GMT
|
|
raymond
Junior Member
Posts: 53
Posts: 53
|
Post by raymond on Mar 20, 2024 13:53:20 GMT
Thanks, you pointed me in the right direction. I got it working.
public WavePrefabPool myPrefabPool; // Assign this in the Unity Editor
Transform spawnedTransform = myPrefabPool.GetRandomWeightedTransform(); // Use the instance to call the method
if (spawnedTransform != null) { GameObject spawned = PoolBoss.SpawnInPool(spawnedTransform, spawnPoint.position, spawnPoint.rotation).gameObject;
|
|
|
Post by DarkTonic Dev on Mar 20, 2024 15:02:23 GMT
Nice. No problem.
|
|