Search Unity

Showcase RectMask2DCulling - optional Culling / Softness, better performance

Discussion in 'UGUI & TextMesh Pro' started by mitaywalle, Jul 6, 2022.

?

I need some feedback, please, press yes, if you use RectMask2DCulling in your project

  1. Yes

    4 vote(s)
    100.0%
  2. No, I've just read thread

    0 vote(s)
    0.0%
  1. mitaywalle

    mitaywalle

    Joined:
    Jul 1, 2013
    Posts:
    253
    Custom RectMask2D, that allow to disable Culling / Softness

    Available at Github

    Problem

    Built-in RectMask2D has overhead, that grow linearly with count of active Child UI.Graphic, main reason for this - Culling. When all this UI.Graphic is always visible (if Pooled ScrollRect or Optimized ScrollView Adapter used, for example) - Culling is useless

    And you can't disable it


    Solution

    Inherit from RectMask2D and add flags to disable Culling

    Performance

    - Profiled at Honor 10X Lite
    - 50 child TextMeshPro
    - 400 child other various UI.Graphic (UI.Image, UI.RawImage, UI.Text)

    - RectMask2D
    RectMask2D_profiling.jpg

    - RectMask2DCulling , Culling and Softness disabled
    RectMask2DCulling_profiling.jpg

    - RectMask2DCulling use reflection to get private properties of parent RectMask2D class, and it add performance overhead
    RectMask2DCulling_performance_scheme.jpg
     
    Last edited: Jul 6, 2022