diff --git a/vr-configurator/Assets/Scripts/Models/ModelBehaviour.cs b/vr-configurator/Assets/Scripts/Models/ModelBehaviour.cs index fb90a19..6951d35 100644 --- a/vr-configurator/Assets/Scripts/Models/ModelBehaviour.cs +++ b/vr-configurator/Assets/Scripts/Models/ModelBehaviour.cs @@ -39,9 +39,6 @@ public class ModelBehaviour : MonoBehaviour, IResettable public PortSelector PortSelector; public int Index = -1; - const int FinalColorTick = 60; //shouldnt take too long - Color _oldColor = Color.black; - int colorTick = FinalColorTick; Color _color = Color.black; Color Color { @@ -49,8 +46,10 @@ public class ModelBehaviour : MonoBehaviour, IResettable set { var clonedMaterial = new Material(meshRenderer.material); //clone da sonst alle anderen mit dem mat auch colorchanged werden - meshRenderer.material = clonedMaterial; // Actual color setting happens in Update + clonedMaterial.color = value; + meshRenderer.material = clonedMaterial; Debug.Log($"{name}: Set color from {_color} to {value}"); + _color = value; if (Model.Passthrough) { Debug.Log($"{name}: Passthrough {_children.Count}"); @@ -60,9 +59,6 @@ public class ModelBehaviour : MonoBehaviour, IResettable go.GetComponent().Color = value; } } - _oldColor = _color; - _color = value; - colorTick = 0; } } @@ -77,15 +73,6 @@ public class ModelBehaviour : MonoBehaviour, IResettable ModelManager = FindFirstObjectByType(); } - void Update() - { - if (colorTick < FinalColorTick) - { - meshRenderer.material.color = Color.Lerp(_oldColor, _color, colorTick * 1.0f / FinalColorTick); - colorTick++; - } - } - void LateUpdate() { if (!lateInited)