#Object Pooling System for an After Image effect

1 messages · Page 1 of 1 (latest)

maiden sentinel
#

I understand the concept and implementation of an Object Pooling System. I want to make an after image speed effect, and I've watched a video on how to do this. however, this tutorial uses instantiate and destroy, which seems inefficient. However, using this system, won't the baked meshes from the previous instance just end up in memory limbo when replaced by the next set of data? How would I sort this out? if it's an issue at all, I might be overthinking it after all

muted lark
#

What baked meshes?

#

You'd need to show the system you're talking about for context

maiden sentinel
# muted lark You'd need to show the system you're talking about for context

In this video, the guy bakes skinnedmeshrenderers into standard meshes for use by a standard mesh renderer
https://www.youtube.com/watch?v=7vvycc2iX6E&t=400s

With this Unity tutorial now you can add a cool Trail to your Characters! Super useful for when trying to convey a speed boost or a quick character movement, like a dash. I am speed!!!

I am making a game, check it out: https://twitter.com/GoldenBugStudio

00:00 Intro
00:51 Mesh Trail Script - Start
04:54 Baking the Mesh
08:05 Glow Shader
10:2...

▶ Play video
#

this is the code for context

muted lark
#

You can pool both the GameObejcts and the Meshes

maiden sentinel
#

and enable and disable and overwrite the meshes

muted lark
#

there's no need to make anything at the start

maiden sentinel
#

as needed

maiden sentinel
muted lark
muted lark
#

it's about when to destroy them

#

instead of destroying them you put them back in the pool to be reused

maiden sentinel
#

oh right

muted lark
#

but there's no reason to "pre-cook" the pool most of the time

maiden sentinel
#

i thought part of the pool system would be to create a bunch of them at the start

#

okay thats fine then

#

i didnt know that api existed

#

thats cool

#

makes it easy for me

muted lark
#

Unless creating the objects is prohibitively costly, there's not much benefit to that.

#

It's more about avoiding the overhead of garbage collection

#

you're only creating at most a few each frame here.

maiden sentinel
muted lark
#

it doesn't disappear

#

you're just changing the data

#

you're modifying a mesh in place, instead of discarding an old one and creating a new one

maiden sentinel
#

oh i seeee

#

i thought it discarding

#

thats fine then thats easy enough

muted lark
#

that's what you avoid with the pooling

maiden sentinel
#

i get it now

#

cool, thank you!

#

that object pool thing looks exactly what i need

rustic umbra
#

If this is a single character, you can just make a bunch of children of these skinmeshes. You don't exactly need a whole management system for it.