Search Unity

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

    Sentmoraap

    Joined:
    Nov 18, 2012
    Posts:
    3
    Hello,

    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