Hello @gamingislove I'm trying to get notified when the Player Control is Blocked, to be able to change the custom animation system accordingly, but it seems when Changing scenes the Event is not triggered again, leaving the last flag as Blocked (change = 1).
Here's the code I used to debug in the 3D RPG Playground Demo

[SerializeField]
private bool _CharacterInControl;
public bool CharacterInControl => _CharacterInControl;


private void OnDisable()
{
Maki.Control.BlockPlayerChanged -= Control_BlockPlayerChanged;
}

private void Start()
{
Maki.Control.BlockPlayerChanged += Control_BlockPlayerChanged;
}

private void Control_BlockPlayerChanged(int change)
{
_CharacterInControl = (change < 0 ? true : false);
Debug.Log("Control Change: " + change + " IsControlled:" + _CharacterInControl);
}


Is there a better way to do it?
  • edited June 27
    Since this is during scene change - the player is most likely not yet spawned in the new scene when the control is unblocked, so your control script isn't yet created and registered.
    In your component's Start function (or an OnEnable function) you could simply check if player control is blocked and set your bool accordingly:
    _CharacterInControl = Maki.Control.Blocked;
    Post edited by gamingislove on
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
Sign In or Register to comment.