Skip to content

Commit e75f59a

Browse files
committed
fix(SnapDropZone): remove shadows from highlight object
The highlight object on the Snap Drop Zone was casting a shadow and was also set to receive shadows. This fix forces all mesh renderers of the snap drop zone to not cast or receive shadows.
1 parent 56c94cf commit e75f59a

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

Assets/VRTK/Prefabs/Internal/Scripts/VRTK_SnapDropZone.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,7 @@ protected virtual void OnEnable()
350350
}
351351
#pragma warning restore 618
352352

353+
DisableHighlightShadows();
353354
if (!VRTK_SharedMethods.IsEditTime() && Application.isPlaying && defaultSnappedInteractableObject != null)
354355
{
355356
ForceSnap(defaultSnappedInteractableObject);
@@ -586,6 +587,19 @@ protected virtual void GenerateContainer()
586587
}
587588
}
588589

590+
protected virtual void DisableHighlightShadows()
591+
{
592+
if (highlightObject != null)
593+
{
594+
Renderer[] foundRenderers = highlightObject.GetComponentsInChildren<Renderer>(true);
595+
for (int i = 0; i < foundRenderers.Length; i++)
596+
{
597+
foundRenderers[i].receiveShadows = false;
598+
foundRenderers[i].shadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.Off;
599+
}
600+
}
601+
}
602+
589603
protected virtual void SetContainer()
590604
{
591605
Transform findContainer = transform.Find(HIGHLIGHT_CONTAINER_NAME);
@@ -936,6 +950,7 @@ protected virtual void GenerateHighlightObject()
936950
DeleteHighlightObject();
937951
}
938952

953+
DisableHighlightShadows();
939954
SetHighlightObjectActive(false);
940955
SetContainer();
941956
}

0 commit comments

Comments
 (0)