Search Unity

Event handles

Discussion in 'Visual Scripting' started by Tyndareus, Aug 25, 2020.

  1. Tyndareus

    Tyndareus

    Joined:
    Aug 31, 2018
    Posts:
    37
    We have various artists on the team and suddenly the rise for bolt has appeared, some of our background stuff interfaces through some scriptable objects (which have a value changed event), the trigger for that is external (signalr message) but we tend to subscribe to said event in various scenarios.
    How would someone who isn't going to be coding manage the subscription? Having had a look myself it seems it only supports events that are defined in a graph but i might not be looking correctly.
     
  2. MasterSubby

    MasterSubby

    Joined:
    Sep 5, 2012
    Posts:
    252
    You may want to start looking into building a custom unit for your events. Custom Events do no have an awareness of subscribing new data or events. They can only be manually triggered in graph or code.

    If you have never touched the Units API, I have beginner tutorials here -> https://lifeandstylemedia.com/docs/manual/entries/bolt/tutorials/CustomUnits_Introduction.php

    And when you get to events, you'd want to Inherit ManualEvent. Overriding StartListening and StopListening with an input or header (UnitHeaderInspectable attribute for header fields) for your ScriptableObject. Start and Stop listening is where you'd subscribe to the event and unsubscribe.