- Home /
Pooled object keeps changing spawn position?
Before i start this off, I'm pretty beginner (high schooler) and also using the Playmaker visual scripting tool and not basic coding, however I don't believe this to be a Playmaker issue. I have a pooled object that spawns from an animal in my scene which can then be collected by the player. This all works perfectly fine, but recently I noticed that the spawned object is changing positions each time it is spawned. At the moment it is set to spawn using an animation event, but I changed to a wait function and this issue keeps happening. It mostly changes position on the y axis, and seems to cycle through four or five points. I've remade the prefab and logic entirely for the collectible object, the animal, and switched from creating and destroying to pooling, and still the issue persists. Absolutely no clue why this is happening or how to fix it. Anyone got any suggestions?
Answer by SilentVoidTreeShop · May 22, 2021 at 03:44 AM
for anyone wondering: i solved it! it must have been an issue with the animation event and the location of the animal. what i did was create an empty at the same place as the animal, but NOT parented. by using the empty as the point for the pooled objects to spawn, i no longer have this position cycling issue. wish there was another way to fix it but alas
Answer by RobertSbruno · May 24, 2021 at 09:17 AM
By default a newly spawned object is owned by the server. To get more control about the object lifecycle, MLAPI has built in object pooling.