Triggering or Activating Visual Script custom event from c#.

So my friend an I have been working on a project together. I am primarily using VS as he is using c#. I’ve found how to use c# methods in my scripts and incorporate them in VS. Sadly I haven’t found any information on “triggering” or activating an event node in the VS graph through c# though. I want one of his methods to call a “event” node in my graph. Is this possible? or do I have to rewrite this specific script into c#? Any help with direction would be greatly appreciated!

Cheers.

Consult the docs for triggering Custom Events from C# scripts: Events node | Visual Scripting | 1.7.8

The namespaces are outdated though. Bolt and Ludiq namespace contents are migrated under Unity.VisualScripting namespace. The rest is correct.

Thank you so much! This is so much easier then we thought. We got the script working as intended now.

CustomEvent.Trigger works fine. How to receive virtual script custom events from C# scripts。

What is the counterpart of EventBus.Register?

Got it working with:

public class ... : MonoBehaviour
{
    private void Start()
    {
        void Handler(CustomEventArgs args) => OnVSCustomEvent(args);
        EventBus.Register(new EventHook(name: EventHooks.Custom, target: gameObject),
            (Action<CustomEventArgs>)Handler);
    }

    private void OnVSCustomEvent(CustomEventArgs args)
    {
		// Your response to event
		// Event name: args.name
		// Event args[]: args.arguments
    }
}