Can not set particle start coloor in OnEnable

as the title, i am using an object with a particle system atached to it, the object is pooled and the particle start colour is set to go from red to green by lerp, then when it reaches end of lerp the object is disabled and sent to the object pool, i need a way of resetting the start color back to its original rgba values when it gets enabled again when used from the pool but puting the set color code in OnEnable just does not change the color back it stays at green, i have tried to put it also in OnDisable but it still will not change, i can not use awake or start as these are only called the first time the object is used.

any ideas gratefully recieved.

The first most-obvious thing to check: Is the OnEnable even being called as you expect?

The next thing is how are you setting the colors? ParticleSystems and their modules are a weird mishmash of value- and reference types (structs and classes), and it is finnicky to make sure you’re copying the right info back into the Unity object itself. Maybe post some code?

Figured it out, for some reason the script was disabling itself after the lerp had completed, i removed the script and re added it and now it seems to be working fine.

thanks

1 Like