Skip to content

Commit a7f3459

Browse files
committed
Fixed SpatialMesh disapearing when AllowMeshVisualizationControl enabled on TapToPlace and Draw Visual Meshes enabled
1 parent 813d94b commit a7f3459

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

Assets/HoloToolkit/Input/Scripts/Interactions/TapToPlace.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ public class TapToPlace : MonoBehaviour, IInputClickHandler
4141
[Tooltip("Setting this to true will allow this behavior to control the DrawMesh property on the spatial mapping.")]
4242
public bool AllowMeshVisualizationControl = true;
4343

44+
private bool initialMeshVisualizationSetting = false;
45+
4446
private Interpolator interpolator;
4547

4648
/// <summary>
@@ -58,6 +60,12 @@ protected virtual void Start()
5860
PlaceParentOnTap = ParentGameObjectToPlace != null;
5961
}
6062

63+
if (SpatialMappingManager.Instance != null && AllowMeshVisualizationControl)
64+
{
65+
initialMeshVisualizationSetting = SpatialMappingManager.Instance.DrawVisualMeshes;
66+
}
67+
68+
6169
interpolator = EnsureInterpolator();
6270

6371
if (IsBeingPlaced)
@@ -177,9 +185,9 @@ private void RemoveWorldAnchor()
177185
/// </summary>
178186
private void ToggleSpatialMesh()
179187
{
180-
if (SpatialMappingManager.Instance != null)
188+
if (SpatialMappingManager.Instance != null && initialMeshVisualizationSetting == false && AllowMeshVisualizationControl)
181189
{
182-
SpatialMappingManager.Instance.DrawVisualMeshes = IsBeingPlaced && AllowMeshVisualizationControl;
190+
SpatialMappingManager.Instance.DrawVisualMeshes = IsBeingPlaced;
183191
}
184192
}
185193

0 commit comments

Comments
 (0)