In my custom editor I call a complex function on the target script, ReCalc(), which modifies large meshes, which on my machine takes around 100ms.
If I invoke this function via a button, a key-press, or some other ‘single’ method, it runs as expected. Calling it sequentially multiple times, gives the same expected result, i.e. it can execute about 10 times per second. (In this particular case, you can see the mesh update 10fps)
However, if I’m modifying a parameter of that function via an editor slider, which necessarily means calling ReCalc() as the slider is changed, you can clearly see a big slowdown, and it only manages to do 1 or 2 updates per second instead of 10.
Running a timer on the function still shows the expected 100ms, so that doesn’t help.
It’s like the constant flow of commands from the slider is interupting itself, and causing massive lag.
I’ve noticed this is a consistent problem when calling heavy-duty processing from a slider, this is just one example where it’s very easy to see .
Is there an established practice for dealing with this, as I guess it must be quite a common scenario?
Thanks.