I just purchased core gamekit and am trying to set it up. I have read threw the docs and watched the setup video of the killables script but am still having an error pop up everytime my objects interact.
The error is : Object reference not set to an instance of an object PoolBoss.get_Trans()(.../PoolBoss.cs:456)
I have a killable set on the bullets and on player, with only the bullets needing to do damage at the moment. If you need any further information from me let me know, Thanks for any help!
that was it, didnt see that i needed to add that. I am now having another error.
I checked the "auto-add missing items" box just to speed up the process of getting everything working, It only adds two objects: my bullet prefab and the explosion prefab.
The error is : No transform passed to Spawn method
The functions seem to work though, once the bullet makes contact, it disappears and explosion happens, both spawn and disappear off game and are located in poolboss. So I dont really know what the error is coming from or even what its effecting.
It will only add things to the pool as they're despawned or spawned. That error you quoted I've never seen. There may be another more important error above it? I'll need full stack track with line numbers.
figured it out, i had accidentally put the "damage prefab settings" to "per hit" when nothing is/was/should be spawning from the bullet. That error went away.
New issue im having is that, in the poolboss item settings, i put the bullet prefab inside with a quantity of 10. Upon game start it loads all 10 objects inside the poolboss, but the bullet when spawned from my trigger comes out as bullet(clone) and thus does not go inside poolboss unless i keep the "auto-add missing items" check box checked.
I have the bullet prefab in a prefab folder inside the assets folder of the project, do i need to move my prefabs to a different folder for corekit? Or is it not possible to pool objects that are spawned outside of corekit? Such as the bullets are spawned from a turret, when player enters turret line of sight turret fires a bullet at player. All this was made with playmaker so the spawning comes from an empty game object on the turret muzzle and spawns every 2 secconds ect ect.
Ok, I've fixed the error for the Damage Prefab so it tells you what to do now instead. This will be in the next update.
I can't reproduce the other problem you're seeing. For me, I never get "(Clone)" in the name because Pool Boss removes that part of the name after the item is created. Folders don't matter. You can pool objects that are spawned outside of Core Gamekit, but the name is the key. If you have something with (Clone) in the name that's considered a different item than the ones without (Clone) in the name.
So if you want to get pooling working correctly and uniform, do one of 2 things.
1) Always use Pool Boss to spawn everything. You said you are using Playmaker, so use the "Core Game Kit Pool Boss Spawn" custom action that's included (optional Playmaker package for Core GameKit). I think you're using Instantiate to create the bullets, which is terrible on performance.
2) Rename the object to remove the "(Clone)" part of the name after creating it.
#1 is preferable and the best way to do it. You should never use any Instantiate or Destroy calls when you're using pooling.
option 1 worked perfect for the bullets, the explosion that happens works at first then stops. What seems to be happening is the explosion is inactive until used, then activates and stays active. it doesnt seem to go back to inactive so it can be reactivated.
the explosion consists of
explosion(empty game object) -Sound game object -Particles(empty game object) -explosion(particle system) -light(light game object)
Now i have attached killable script and killable child visability in different combinations to some/all of the objects with the same results. The explosion is inactive at the start of game and pooled correctly, after it is used it doesnt despawn itself to be used again it just stays active.
Is there another script i need to use on it instead of killables?
edit 1#: the explosion prefab is being spawned from the bullet prefab killable script inside the "explosion prefab" box
edit 2#: when i click on "take 1 damage" on the explosion inside the poolboss it will despawn the explosion and make it usable again.
edit 3#: found a work around, or maybe its the right way. But i added a playmaker script to the explosion prefab and put a "wait x seconds" then after that i put another state that says "core kit killable despawn" and just left it on owner. I put the wait time so that the explosion animation can go all the way threw before it goes away then it resets itself to be used again. seems to be working great now, dont know if its the best option for performance so if theres a different way i should be doing it let me know. thanks!
Post by DarkTonic Dev on Jan 11, 2015 19:42:23 GMT
Yeah #3 is similar to what you need to do. That option will work but it adds extra FSMs to your game, which will be bad on performance eventually. There's an easier way that doesn't require Playmaker actions.
1) Put a TimedDespawner component (from Core GameKit) on the Explosion empty game object and set its "Despawn Timer" to wait X seconds. That will automatically despawn the particle after X seconds using Pool Boss.
Before we had a "particle despawner" component that didn't require setting the X seconds but it was worse on performance so we got rid of it.