I've got some prefabs that undergo changes during their lifecycle and I'm having to circle back around to undo these changes in my scripts if I need them to be in their initial state the next time they spawn.
Example: There are times when objects change colors, shift layers, run timers, etc. So I'm storing all their initial info in various variables On Enable and then re-applying it all after the object despawns back to the pool. Seems to be working fine for now but it's not very flexible code as it has to be pretty specific to each object depending on what it is. I noticed there's a PoolBoss.Initialize() but that seems to reset the whole thing and not specific objects on demand. Is there another function I'm missing or any advice on how to achieve this?
Post by DarkTonic Dev on Jan 11, 2019 16:16:54 GMT
There is actually no way to do this with generic code unfortunately. This is something you will need to code. The best place to put it is in the ondespawned event that gets called just before despawning. All pooling plugins require doing this because you are reusing objects. I remember making code to do such a thing when using pool manager back in 2013.