/// <summary> /// Apply all the properties from the scene we loaded onto the fixed layer /// </summary> /// <param name="targetLayer">The target fixed layer</param> /// <param name="fixedLayerProperties">The data object containing the loaded properties</param> private void SetFixedLayerProperties(InterfaceLayer targetLayer, SerializableScene.FixedLayer fixedLayerProperties) { //Apply all materials for (int i = 0; i < fixedLayerProperties.materials.Length; i++) { var materialProperties = fixedLayerProperties.materials[i]; Material materialInSlot = targetLayer.GetMaterialFromSlot(materialProperties.slotId); materialInSlot.SetColor("_BaseColor", new Color(materialProperties.r, materialProperties.g, materialProperties.b, materialProperties.a)); } targetLayer.UpdateLayerPrimaryColor(); }
/// <summary> /// Apply all the properties from the scene we loaded onto the fixed layer /// </summary> /// <param name="targetLayer">The target fixed layer</param> /// <param name="fixedLayerProperties">The data object containing the loaded properties</param> private void SetFixedLayerProperties(InterfaceLayer targetLayer, SerializableScene.FixedLayer fixedLayerProperties) { //Apply all materials for (int i = 0; i < fixedLayerProperties.materials.Length; i++) { var materialProperties = fixedLayerProperties.materials[i]; Material materialInSlot = targetLayer.GetMaterialFromSlot(materialProperties.slotId); if (materialProperties.a == 1) { if (targetLayer.opaqueShaderSourceOverride) { materialInSlot.shader = targetLayer.opaqueShaderSourceOverride.shader; } else { materialInSlot.CopyPropertiesFromMaterial(opaqueMaterialSource); materialInSlot.SetFloat("_Surface", 0); //0 Opaque } } else { if (targetLayer.transparentShaderSourceOverride) { materialInSlot.shader = targetLayer.transparentShaderSourceOverride.shader; } else { materialInSlot.CopyPropertiesFromMaterial(transparentMaterialSource); materialInSlot.SetFloat("_Surface", 1); //0 Alpha } } materialInSlot.SetColor("_BaseColor", new Color(materialProperties.r, materialProperties.g, materialProperties.b, materialProperties.a)); } targetLayer.UpdateLayerPrimaryColor(); }