Skip to content

Commit 7f5528b

Browse files
authored
FIX: Fixed a memory leak in OnScreenStick (#2006)
1 parent 7a28d7b commit 7f5528b

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

Packages/com.unity.inputsystem/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ however, it has to be formatted properly to pass verification tests.
1212

1313
### Fixed
1414
- Fixed Multiple interactions could breaks on Composite Binding. [ISXB-619](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-619)
15+
- Fixed memory leak when the OnScreenStick component was destroyed [ISXB-1070](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-1070). Contribution by [LukeUnityDev](https://github.com/LukeUnityDev).
1516

1617
### Changed
1718
- Renamed editor Resources directories to PackageResources to fix package validation warnings.

Packages/com.unity.inputsystem/InputSystem/Plugins/OnScreen/OnScreenStick.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,15 @@ private void Start()
136136
image.alphaHitTestMinimumThreshold = 0.5f;
137137
}
138138

139+
private void OnDestroy()
140+
{
141+
if (m_UseIsolatedInputActions)
142+
{
143+
m_PointerDownAction.started -= OnPointerDown;
144+
m_PointerDownAction.canceled -= OnPointerUp;
145+
}
146+
}
147+
139148
private void BeginInteraction(Vector2 pointerPosition, Camera uiCamera)
140149
{
141150
var canvasRectTransform = UGUIOnScreenControlUtils.GetCanvasRectTransform(transform);

0 commit comments

Comments
 (0)