public override void OnGUI(MaterialEditor materialEditor, MaterialProperty[] props) { using (var changed = new EditorGUI.ChangeCheckScope()) { uiBlocks.OnGUI(materialEditor, props); // Apply material keywords and pass: if (changed.changed) { foreach (var material in uiBlocks.materials) { SetupMaterialKeywordsAndPassInternal(material); } } } }
public override void OnGUI() { // Disable the block if one of the materials is not transparent: if (materials.Any(material => material.GetSurfaceType() != SurfaceType.Transparent)) { return; } using (var header = new MaterialHeaderScope(Styles.header, (uint)m_ExpandableBit, materialEditor)) { if (header.expanded) { transparencyBlocks.OnGUI(materialEditor, properties); } } }
public override void OnGUI(MaterialEditor materialEditor, MaterialProperty[] props) { LoadMaterialProperties(props); SerializedProperty instancing = materialEditor.serializedObject.FindProperty("m_EnableInstancingVariants"); instancing.boolValue = true; using (var changed = new EditorGUI.ChangeCheckScope()) { uiBlocks.OnGUI(materialEditor, props); var surfaceInputs = uiBlocks.FetchUIBlock <DecalSurfaceInputsUIBlock>(); // Apply material keywords and pass: if (changed.changed) { normalBlendSrc.floatValue = surfaceInputs.normalBlendSrcValue; maskBlendSrc.floatValue = surfaceInputs.maskBlendSrcValue; maskBlendMode.floatValue = (float)surfaceInputs.maskBlendFlags; smoothnessRemapMin.floatValue = surfaceInputs.smoothnessRemapMinValue; smoothnessRemapMax.floatValue = surfaceInputs.smoothnessRemapMaxValue; AORemapMin.floatValue = surfaceInputs.AORemapMinValue; AORemapMax.floatValue = surfaceInputs.AORemapMaxValue; if (useEmissiveIntensity.floatValue == 1.0f) { emissiveColor.colorValue = emissiveColorLDR.colorValue * emissiveIntensity.floatValue; } else { emissiveColor.colorValue = emissiveColorHDR.colorValue; } foreach (var material in uiBlocks.materials) { SetupMaterialKeywordsAndPassInternal(material); } } } materialEditor.serializedObject.ApplyModifiedProperties(); }
public override void OnGUI(MaterialEditor materialEditor, MaterialProperty[] props) { // always instanced SerializedProperty instancing = materialEditor.serializedObject.FindProperty("m_EnableInstancingVariants"); instancing.boolValue = true; using (var changed = new EditorGUI.ChangeCheckScope()) { uiBlocks.OnGUI(materialEditor, props); if (changed.changed) { foreach (var material in uiBlocks.materials) { SetupMaterialKeywordsAndPassInternal(material); } } } // We should always do this call at the end materialEditor.serializedObject.ApplyModifiedProperties(); }