Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Join us on Thursday, June 8, for a Q&A with Unity's Content Pipeline group here on the forum, and on the Unity Discord, and discuss topics around Content Build, Import Workflows, Asset Database, and Addressables!
    Dismiss Notice

Question Embed Visual Scripting functions in scriptable objects and call them from C#.

Discussion in 'Visual Scripting' started by Sentmoraap, Mar 2, 2023.

  1. Sentmoraap


    Nov 18, 2012

    I have a scriptable objects that basically represents a dialog graph. Some choices have consequences. I want do give a tool to the designer to specify those consequences. A C# script will then execute them. This looks like a good use case for Visual Scripting. But I don’t know how to do it. Ideally each choice would have a button in a custom inspector to open it’s function in the Visual Scripting editor.

    I can expose a ScriptGraphAsset, but it looks like it’s the wrong thing to expose. There is EventBus.Trigger but EventHooks are not exposed in the inspector and the string overload needs a GameObject. I don’t know in which graph it will find that function name.

    So how can I specify which Visual Scripting function to call and then call it from C# ?

    EDIT: nevermind, I will do it without Visual Scripting.
    Last edited: Mar 3, 2023