Open unitycoder opened 4 years ago
Hi ! any idea what to do to improve ?
some ideas: CompareThreshold can be probably improved (and inlined) to something simpler and branchless, https://github.com/unitycoder/UnityMobilePaint/blob/master/Assets/MobilePaint/Scripts/MobilePaint.cs#L1813
looks like queue generates garbage, should use something faster. see comments here for possibly faster flood fills https://unitycoder.com/blog/2012/10/10/flood-fill-algorithm/ or maybe queue without allocations https://forum.unity.com/threads/thread-safe-queue-with-no-allocations.308842/#post-2686958
or whole floodfill operation could be done in another thread (pure thread or unity jobs..) to fill the array, then just trigger texture update on mainthread once calculation is done.
doesnt look good: