+3
Under Review
Lazlo Bonin (Lead Developer) 3 months ago • updated 2 months ago 11 1 duplicate

Duplicates 1

Can you clarify what that means?

Just an idea I had. You would add a special event called "Inspector Button" in a flow graph and give it a label. Then, in the inspector for that flow machine, a button with that label would be added, and when you click it, even when in edit-mode, the associated event would be triggered.

This would let you do cool editor scripting right within Bolt. For example, you could have graphs to generate a procedural map, and trigger them from the inspector with that event.

Very good idea if it can be implemented.

Under Review

Merging with another Idea topic, let me know if that's what you meant.

Hey Lazlo

This sounds like a good start :)

However ideally I would like not to have to press a button. A "Force refresh"-button would still be good to have but ideally the event would be triggered automatically when the gameobject is moved, when a subobject of the gameobject is moved or when a variable changes.

To put this into context; in UE4 I would use blueprints extensively for world building. I would make "deco" objects which ie. could be a collection of objects that were z-projected onto whatever they would collide with. This was a quick way to add lots of ground detail such as shrubs, rocks etc etc. The placement of these subobjects would be updated automatically whenever the parent was moved. Having to press a button with Bolt for this update to be triggered would get annoying quickly as part of the value by doing it this way was the instant visual feedback you got.

Hope this explains well enough but please let me know if you are unsure what I mean.

Thanks

I read the documentation on construction scripts after your comment and I must say I'm a bit confused.

If you create objects during the construction script (e.g. add deco), do they get deleted when the construction script re-runs? How does it know that these objects are "bound" to this script?

What exactly is the event that triggers a construction script? Creating an object? Moving an object? Having a parent or child in its hierarchy change? 

As I understand it the construction script is run when the gameobject is first added to the scene, when it is moved, when a hierarchical subobject is moved or when a variable change.

Adding to that a force refresh button would also be a good idea for situations where the construction is not called automatically.

If the spawned objects are not a hierarchical child I guess it could also be up to the user to create an array in the flowgraph to keep track of spawned objects and then call the desired changed on those objects when the construction script reruns.

I havent really worked much with blueprints for some time (since switching to unity) so excuse me that I cant give you an exact answer how the construction scripts work :)

I guess an option to add the executeineditmode attribute is really what I am asking for - ?


Hmm. Seems very similar to what assets like Octave3D and ProCore do to add and manipulate objects/prefabs in editor/scene. That could be useful as an option. 

The problem with ExecuteInEditMode and similar approaches is that any object you create will be permanent and won't get magically destroyed if you execute the creation code again. I'll look into how I could do it, but the traditional Unity approach is not to generate elements by script automatically, rather to create a custom editor (or button) and save prefabs.