0
Answered

Run flow machine in editor

Zefugi 1 year ago updated by Lazlo Bonin (Lead Developer) 1 year ago 3

I got a bunch of functions for generating landscapes, and I would like to chain them together in a flow graph, to easily build different terrains. This part actually works fine, but I would like to run the flow graph in the editor, and that part causes some problems.

At the moment I got a semi-working version where I trigger a Unity event, that triggers the graph and it runs just fine. Problem is 2nd time I try to run it it doesn't trigger, and I have to remove the macro from the gameobject and re-attach it, to make it work again.

Bolt Version:
Latest from Assetstore
Unity Version:
2019.1
Platform(s):
Scripting Backend:
.NET Version (API Compatibility Level):
GOOD, I'M SATISFIED
Satisfaction mark by Zefugi 1 year ago

At this moment this is not really possible. 

You can use on draw gizmo or on gizmo select in the editor but keep in mind that this works like a update event. 

+1

Not sure if I understood correctly, but the Community addon has a Manual Event that you can trigger in Editor with a button on the Graph. Not sure if that fits your use-case or not though.

https://github.com/RealityStop/Bolt.Addons.Community/releases/tag/2.4

Answered

That is currently indeed the right approach. You could also link event firing logic to your custom editor / window / property drawer by using the Events API: https://ludiq.io/bolt/manual/scripting/events

For example:

if (GUILayout.Button("Trigger Event"))
{
    CustomEvent.Trigger(myGameObject, "EventName", argument1, argument2, etc.);
}