Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,17 @@ private void Awake()
InitializeInteractionModeDetectors();
}

/// <summary>
/// A Unity event function that is called when the script component has been destroyed.
/// </summary>
private void OnDestroy()
{
if (InteractionManager != null)
{
InteractionManager.interactorRegistered -= OnInteractorRegistered;
}
}

/// <summary>
/// A Unity Editor only event function that is called when the script is loaded or a value changes in the Unity Inspector.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ internal static Bounds CalculateBounds(
finalBounds.Encapsulate(root.InverseTransformPoint(totalBoundsCorners[i]));
}

totalBoundsCorners.Clear();
childTransforms.Clear(); // Avoid keeping reference to Unity objects to avoid "Leaked Memory Shell"
return finalBounds;
}

Expand Down
13 changes: 13 additions & 0 deletions org.mixedrealitytoolkit.uxcore/Interop/UGUIInputAdapter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,19 @@ protected override void OnDisable()
}
}

/// <summary>
/// A Unity event function that is called when the script component has been destroyed.
/// </summary>
protected override void OnDestroy()
{
base.OnDestroy();
if (InteractionManager != null)
{
InteractionManager.interactorRegistered -= OnInteractorRegistered;
InteractionManager.interactorUnregistered -= OnInteractorUnregistered;
}
}

/// <summary>
/// Called when a an <see cref="IXRInteractor"/> is registered with a Unity <see cref="XRInteractionManager"/>.
/// </summary>
Expand Down