private void ReorderRender(UnityEngine.Material[] materials) { if (materials.Length == 0) { return; } var order = new UnityEngine.Material[materials.Length]; Array.Copy(materials, order, materials.Length); order.OrderBy(mat => mat.renderQueue); var lastQueue = int.MinValue; foreach (var mat in order) { if (lastQueue >= mat.renderQueue) { mat.renderQueue = lastQueue++; } else { lastQueue = mat.renderQueue; } } }