Avoid freezing on changing the alphamap of nine Terrains (tiles)

Hi, well I have this awful problem that I don’t know how to solve it… (I know why it’s caused…)

I’m thinking on using co-routines/threads (but they aren’t safe) in Unity, but I don’t know how they works in this kind of situations…

So can somebody help me with this or recommend me something?

EDIT:

I had change the alphamapResolution (from 512 to 16), and the tiling Size (from 15 to 5), but it still freezes like 2 seconds (instead of 10 seconds before)… So, can you recommend me something to change more?

The script that I use is @tanoshimi’s Procedural Terrain Splatmapping script

So, thanks in advance to everybody that will help me!

Bye.

Well, I fixed it doing what @SomeRandomGuy said and optimizing the script, before, I think that the function was called like 3 times, now only one…

So, thanks to tanoshimi and SomeRandomGuy for recommend me something… (Yes, I did both recommendations)