private void doUpdateSprite(Transform t, CompareFunction comp, int stencil) { #if SPRITE_MASK_DEBUG log("doUpdateSprite >>> t=" + t.name + " comp=" + comp + " stencil=" + stencil + " t.childsCount=" + t.childCount); #endif SpriteMask mask = getSpriteMask(t); if (mask != null) { if (mask != this && mask.enabled) { #if UNITY_EDITOR if (Application.isPlaying) // Don't update in edit mode. Update() will be called on child masks. #endif mask.update(); return; } } else { Renderer r = getRenderer(t); #if SPRITE_MASK_DEBUG log("doUpdateSprite: renderer=" + r); #endif if (r != null) { Material m = r.sharedMaterial; #if SPRITE_MASK_DEBUG log("doUpdateSprite: material=" + m); #endif if (m == null || !m.HasProperty(propertyStencil)) { m = defaultSpriteMaterial; r.sharedMaterial = m; } m.renderQueue = spriteRenderQueue; updateMaterial(m, stencil, comp, null); } } int childsCount = t.childCount; if (childsCount > 0) { for (int i = 0; i < childsCount; i++) { doUpdateSprite(t.GetChild(i), comp, stencil); } } #if SPRITE_MASK_DEBUG log("doUpdateSprite <<<"); #endif }