public bool ShouldUpdateMaterialProperty(MaterialPropertyAsset materialProperty) { if (materialProperty.propertyType == MaterialPropertyType.ShaderKeywords) { return(ShaderKeywords == PollingFrequency.UpdateContinuously); } else if (materialProperty.propertyType == MaterialPropertyType.RenderQueue) { return(RenderQueue == PollingFrequency.UpdateContinuously); } else { MaterialPropertyPollingFrequency pollingFrequency; if (PollingFrequencyByMaterialProperty.TryGetValue(new MaterialPropertyKey(materialProperty.ShaderName, materialProperty.propertyName), out pollingFrequency)) { switch (pollingFrequency.updateFrequency) { case PollingFrequency.UpdateContinuously: return(true); case PollingFrequency.UpdateOnceOnStart: return(false); } } // If we have a parent, check the parent to see if the parent has an explicit override list if (materialProperties == PollingFrequency.InheritFromParent && parentParameters != null) { return(parentParameters.ShouldUpdateMaterialProperty(materialProperty)); } return(materialProperties == PollingFrequency.UpdateContinuously); } }
public bool ShouldUpdateMaterialProperty(MaterialPropertyAsset materialProperty) { using (StateSynchronizationPerformanceMonitor.Instance.MeasureEventDuration(performanceComponentName, "ShouldUpdateMaterialProperty")) { if (materialProperty.propertyType == MaterialPropertyType.ShaderKeywords) { return(ShaderKeywords == PollingFrequency.UpdateContinuously); } else if (materialProperty.propertyType == MaterialPropertyType.RenderQueue) { return(RenderQueue == PollingFrequency.UpdateContinuously); } else { MaterialPropertyPollingFrequency pollingFrequency; if (PollingFrequencyByMaterialProperty.TryGetValue(new MaterialPropertyKey(materialProperty.ShaderName, materialProperty.propertyName), out pollingFrequency)) { switch (pollingFrequency.updateFrequency) { case PollingFrequency.UpdateContinuously: return(true); case PollingFrequency.UpdateOnceOnStart: return(false); } } // If we have a parent, check the parent to see if the parent has an explicit override list if (materialProperties != PollingFrequency.InheritFromParent || parentParameters == null) { return(materialProperties == PollingFrequency.UpdateContinuously); } } } // Stop the timer before calling parent function return(parentParameters.ShouldUpdateMaterialProperty(materialProperty)); }