Skip to content

Commit

Permalink
fix(Interaction): only instance materials if highlight is used
Browse files Browse the repository at this point in the history
VRTK_Interactable object grabs each material to change the color
if highlighting is used. This breaks batching support in Unity
and so it is now only set if highlighting is actually used.
  • Loading branch information
mattboy64 committed Aug 30, 2016
1 parent ebf7b0e commit d1c53e8
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion Assets/VRTK/Scripts/VRTK_InteractableObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,11 @@ public virtual void ToggleHighlight(bool toggle, Color globalHighlightColor)
Color color = (touchHighlightColor != Color.clear ? touchHighlightColor : globalHighlightColor);
if (color != Color.clear)
{
if (originalObjectColours == null)
{
originalObjectColours = StoreOriginalColors();
}

var colorArray = BuildHighlightColorArray(color);
ChangeColor(colorArray);
}
Expand Down Expand Up @@ -421,7 +426,10 @@ protected virtual void Awake()

protected virtual void Start()
{
originalObjectColours = StoreOriginalColors();
if (highlightOnTouch)
{
originalObjectColours = StoreOriginalColors();
}
}

protected virtual void Update()
Expand Down

0 comments on commit d1c53e8

Please sign in to comment.