private void ApplyBucket(PerformanceBucket bucket) { var newShaderLevel = bucket.ShaderLevel; while (newShaderLevel > 0 && (newShaderLevel > materialList.Length || materialList[newShaderLevel] == null)) { --newShaderLevel; } if (newShaderLevel != currentShaderLevel && newShaderLevel >= 0 && newShaderLevel < materialList.Length && materialList[newShaderLevel] != null && objectRenderer != null) { // to create an instance do Instantiate() // objectRenderer.material = Instantiate(materialList[newShaderLevel]); objectRenderer.material = materialList[newShaderLevel]; currentShaderLevel = newShaderLevel; Debug.LogFormat("[ShaderControl.PerformanceBucketChanged ({0})]", newShaderLevel); } }
private void PerformanceBucketChanged(PerformanceBucket perfBucket) { ApplyBucket(perfBucket); }