Remove bindings for InputEvent and InputAxis on dispose.

This commit is contained in:
Chandler Cox
2024-08-21 12:48:46 -05:00
parent d779862271
commit 6b0098bb09
2 changed files with 10 additions and 0 deletions

View File

@@ -60,6 +60,7 @@ namespace FlaxEngine
~InputAxis()
{
Input.AxisValueChanged -= Handler;
ValueChanged = null;
}
/// <summary>
@@ -68,6 +69,7 @@ namespace FlaxEngine
public void Dispose()
{
Input.AxisValueChanged -= Handler;
ValueChanged = null;
GC.SuppressFinalize(this);
}

View File

@@ -70,6 +70,10 @@ namespace FlaxEngine
~InputEvent()
{
Input.ActionTriggered -= Handler;
Triggered = null;
Pressed = null;
Pressing = null;
Released = null;
}
private void Handler(string name, InputActionState state)
@@ -100,6 +104,10 @@ namespace FlaxEngine
public void Dispose()
{
Input.ActionTriggered -= Handler;
Triggered = null;
Pressed = null;
Pressing = null;
Released = null;
GC.SuppressFinalize(this);
}