How to update game objects from prefabs in the editor?

I’m working on a puzzle game with multiple (50+) levels and there are a variety (5+) of different background particles for each level. I have set up some prefabs for the background particles using different settings (emission, color etc.). I already have a system for level based settings using Scriptable objects and I want to extend this system to view and update the background particles easily in the editor but I quickly discovered that using OnValidate() and destroying/instantiating doesn’t work that way.


What’s the best approach to update the particles in the editor for this scenario? Should I try to copy the settings from the particle system components of these prefabs to the one I use in each scene or is there a better way?

I solved the problem using Naughty Attributes’ OnValueChanged event instead of using OnValidate for anyone that stumbles upon this issue.

https://dbrizov.github.io/na-docs/attributes/meta_attributes/on_value_changed.html