From a6931693be5a0f69ef90a1a210ef4353bdfe1de7 Mon Sep 17 00:00:00 2001 From: Rapandrasmus <78219215+Rapandrasmus@users.noreply.github.com> Date: Mon, 29 May 2023 01:40:27 +0200 Subject: [PATCH] Fixed rods not recoloring (#441) --- .../Scripts/Games/BuiltToScaleDS/BuiltToScaleDS.cs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Assets/Scripts/Games/BuiltToScaleDS/BuiltToScaleDS.cs b/Assets/Scripts/Games/BuiltToScaleDS/BuiltToScaleDS.cs index 9edd4328e..25846906c 100644 --- a/Assets/Scripts/Games/BuiltToScaleDS/BuiltToScaleDS.cs +++ b/Assets/Scripts/Games/BuiltToScaleDS/BuiltToScaleDS.cs @@ -97,6 +97,7 @@ namespace HeavenStudio.Games private Material[] gridMaterials; private Material[] firstPatternLights; private Material[] secondPatternLights; + private Material[] elevatorObjectMats; [Header("Properties")] [SerializeField] float beltSpeed = 1f; @@ -127,6 +128,15 @@ namespace HeavenStudio.Games elevatorMaterials = elevatorRenderer.materials; beltMaterial = Instantiate(environmentMaterials[8]); environmentMaterials[8] = beltMaterial; + elevatorObjectMats = new Material[] + { + Instantiate(elevatorMaterials[0]), + Instantiate(elevatorMaterials[1]), + Instantiate(elevatorMaterials[2]), + }; + elevatorMaterials[0] = elevatorObjectMats[0]; + elevatorMaterials[1] = elevatorObjectMats[1]; + elevatorMaterials[2] = elevatorObjectMats[2]; elevatorMaterial = Instantiate(elevatorMaterials[3]); elevatorMaterials[3] = elevatorMaterial; gridMaterials = new Material[] @@ -199,6 +209,10 @@ namespace HeavenStudio.Games { mat.SetColor("_Color", currentEnvironmentColor); } + foreach (var mat in elevatorObjectMats) + { + mat.SetColor("_Color", currentObjectColor); + } if (!lighting) { foreach (var mat in firstPatternLights)