raymond
Junior Member
Posts: 53
Posts: 53
|
Post by raymond on Sept 13, 2016 17:15:26 GMT
Hello,
My other post disappeared regarding this topic so I am posting it again.
I am using a variable to store a spawned object from PoolBoss using the code below:
GameObject newItem = PoolBoss.SpawnInPool(_gameObject.transform, spawnLocation, spawnRotation).gameObject as GameObject;
Using script I would like to spawn a random Item from a PrefabPool and store it as a variable similar to the above code.
Thank You, Raymond
|
|
|
Post by DarkTonic Dev on Sept 13, 2016 19:56:36 GMT
I think you posted in the Master Audio Multiplayer forum, so apologies for deleting it there, not sure you would receive a notification if I moved it.
So what you need to do is have a public variable of type WavePrefabPool in your script, and drag the prefab pool you want into that field in the Inspector. Assuming you named it prefabPool, then:
var weightedTransform = prefabPool.GetRandomWeightedTransform(); GameObject newItem = PoolBoss.SpawnInPool(weightedTransform, spawnLocation, spawnRotation).gameObject as GameObject;
|
|