I have been able to listen to events from WITHIN a namespace before
Because my Joystick keeps randomly firing out context.canceled events and zeroing out my input I need a different way of saying that my movement input has ended
Not sure as to why I cannot do it the other way around - nothing happens
//Publisher - my Joystick
namespace UnityEngine.InputSystem.OnScreen
{
public class MovementJoystick : OnScreenControl, IPointerDownHandler, IDragHandler,
IPointerUpHandler
{
public static event Action JoystickHasDespawned;
//...
public virtual void OnPointerUp(PointerEventData eventData)
{
input = Vector2.zero;
handle.anchoredPosition = Vector2.zero;
//zero out the control when lifted
SendValueToControl(input);
background.gameObject.SetActive(false);
JoystickHasDespawned?.Invoke();
}
// consumer
void Awake(){
UnityEngine.InputSystem.OnScreen.MovementJoystick.JoystickHasDespawned += StopPlayerMovement;
}
public void StopPlayerMovement(){
Debug.Log("StopPlayerMovement ");
rawInputMovement = new Vector3(0, 0, 0);
}