Search Unity

Trying to subscribe to the .performed. Behavior Designer. StackOverflow Exception.

Discussion in 'Input System' started by FullMe7alJacke7, Aug 20, 2019.

  1. FullMe7alJacke7

    FullMe7alJacke7

    Joined:
    Dec 17, 2013
    Posts:
    55
    I'm trying to use the Input system to detect clicks and integrate that into my behavior designer tree via the Has Received Event.

    I'm getting this log as the first error and I'm not entirely sure what it means.

    Code (CSharp):
    1.         behavior.RegisterEvent("LeftClick", raiseEvent);
    2.         controls.Default_ActionMap.LeftClick.performed += context => raiseEvent();
    3.         behavior.SendEvent(controls.Default_ActionMap.LeftClick.name);
    The second error that pops up says it's coming from the actual SendEvent line.

    Any assistance is appreciated!

    EDIT: I reached out on the behavior designer forums and they're thinking it could be a bug with the input system, can anyone confirm?

    Full script below, same result as above code:

    Code (CSharp):
    1.  
    2.  
    3. using System;
    4. using System.Collections;
    5. using System.Collections.Generic;
    6. using System.Security.Cryptography.X509Certificates;
    7. using BehaviorDesigner.Runtime;
    8. using UnityEngine;
    9. using UnityEngine.Serialization;
    10.  
    11. public class InputListener : MonoBehaviour
    12. {
    13.     [SerializeField] private DefaultActions controls;
    14.     private BehaviorTree behavior;
    15.  
    16.     private delegate void DoStuff();
    17.  
    18.     void Awake()
    19.     {
    20.         controls = new DefaultActions();
    21.         controls.Enable();
    22.         behavior = this.GetComponent<BehaviorTree>();
    23.      
    24.         Action action = () => behavior.SendEvent(controls.Default_ActionMap.LeftClick.name);
    25.         behavior.RegisterEvent("LeftClick", action);
    26.         controls.Default_ActionMap.LeftClick.performed += context => action();
    27.     }
    28.  
    29.     private void NewStuff()
    30.     {
    31.         print("Stuff");
    32.     }
    33.  
    34. }
    35.  
    36.  
     
    Last edited: Aug 22, 2019
  2. jonas-echterhoff

    jonas-echterhoff

    Unity Technologies

    Joined:
    Aug 18, 2005
    Posts:
    1,666
    This means that your "raiseEvent" method threw an exception, in `BehaviorDesigner.Runtime.Behavior.GetDelegate`.
     
    FullMe7alJacke7 likes this.