Search Unity

  1. Looking for a job or to hire someone for a project? Check out the re-opened job forums.
    Dismiss Notice
  2. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Possible to create a base Bolt graph from script?

Discussion in 'Visual Scripting' started by Firemaw, Sep 9, 2020.

  1. Firemaw

    Firemaw

    Joined:
    Aug 24, 2015
    Posts:
    50
    I have a set of flowcharts that can be exported to CSV/XML. I am considering writing a general parser for these to form the basis of a Bolt graph, which can then be edited/tweaked by content developers. This would speed up having to create the Bolt graph from scratch by hand, by looking at the visual flowchart.

    Is it possible to create a Bolt graph and set of connected units from an Editor script?
     
    dannyalgorithmic likes this.
  2. JasonJonesLASM

    JasonJonesLASM

    Joined:
    Sep 5, 2012
    Posts:
    224
    Yup, just create an instance with CreateInstamce<FlowMacro>() save as an asset with Asset database.SaveAssets and Refresh. After those lines your good to do whatever you want and the graph will be fully created and defined.

    Simply add units by creating an instance, do macro.graph.units.Add(unit) and you can access the units, it's port value and do for instance, unit.output.ValidlyConnectTo(anotherPort).

    There is a ton there for this, but it's not fully documented so you'll just have to sift through the members with intellisense or check the source.

    So as long as you can read the data, you could create something to translate that.
     
    Last edited: Sep 13, 2020
    dbdenny likes this.
  3. Firemaw

    Firemaw

    Joined:
    Aug 24, 2015
    Posts:
    50
unityunity