Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question How do I execute ScriptGraphAsset from ScriptableObject?

Discussion in 'Visual Scripting' started by nrvllrgrs, Oct 24, 2022.

  1. nrvllrgrs

    nrvllrgrs

    Joined:
    Jan 12, 2010
    Posts:
    62
    I'm attempting to create a Utility AI. I have a Brain ScriptableObject, which has a list of Actions. I would like to let designers define an Action's behavior via a ScriptGraphAsset, which implements a specific CustomEvent (i.e. an interface of sorts). This architecture allows them to explore various types of actions without engineering becoming a bottleneck. But that said, I have no idea how to execute a ScriptGraphAsset from a ScriptableObject; nor do I have an idea how to start extending the framework to do so.

    In effect, I'm trying to allow designers to define static methods in visual script.
     
  2. PanthenEye

    PanthenEye

    Joined:
    Oct 14, 2013
    Posts:
    2,050
    You can trigger Custom Events from C# code and you can implement custom nodes, but that's pretty much as far as it goes. There's no way of executing ScriptGraph without the ScriptMachine component so it has to exist within Hierarchy somewhere. This incarnation of the tool was designed by a solo developer for the Asset Store users, who are also non-coders and Unity newbies. Data driven workflows were never really considered, and the API wasn't even documented pre-Unity acquisition.
     
    REDACT3D_ likes this.