Slow flood fill of sprite c#

Hey,

I want to implement a slow (over N seconds) flood fill of a sprite over time. I say flood fill as it’s the best term I could find to fit, but essentially I want to colour a random sprite from an X/Y location, spreading out the colour from that point over a time period. I do not need to check the colour underneath or to fill only parts of the sprite. This would change any sprite, fully to a given colour (tinting would be fine) over a period of time.

I have tried doing this pixel by pixel, and it works, but it’s slower than I’d like and I have to believe there is a better way.

Any pointers you could give me would be greatly appreciated.

Thanks

@wijman

Check out this free asset on the asset store Bitmap Drawing API. It does have flood fill capabilities and you can even modify the code to slow down the rate at which a texture is filled. Of course it was created with Unity 4.3.4 but you should not have to much of a problem making it work with Unity 5.

I’ll read up on coroutines, thanks for the advice :slight_smile: