Can I define data structures visually in some Editor Window than hard coding in source files?

divovib 4 years ago updated by Lazlo Bonin (Lead Developer) 2 years ago 5

I often use some complex data structures, so I need to hard code many .cs files.

It's great to be able to define it  just like UML Class Diagram in some Editor Window and use in Graph.

Bolt Version:
Unity Version:
Scripting Backend:
.NET Version (API Compatibility Level):

hmmm, at first I thought a new editor window would be perfect, but UML Diagram is no different at least in looks as to what I looked up. Why not just use Bolt itself? At least that is something I can help you with as at least a temporary solution, if this works for you.

I've off and on worked on this Unit based template code generator for myself. It literally is just all converted inputs into strings, and layed out through code, all the brackets and spaces and comments. I could definitely modify this to do what you want. I could even just make a single unit you can populate all acrossed a macro with different ones. It could have a Modifiable multi type lists, would be pretty easy to do both Enums and Structs this way, since its not logic driven stuff.

Here is what is going on inside, and inside those are just a bunch of spacing and bracket helpers and string conversions. Then the final piece (1st image), is the only thing you would need to modify, but would be different then this, cleaner. If I did it as a custom unit for this, it would be generated in the editor with a button, instead of how I do it, by going into play mode using Start.

And here is an example of one test of it actually generated into .cs files.

And this got me all excited about the idea again, thanks! So I started already. I'm beginning with enums because its so much simpler. Just strings and ints, soo... then I will do the structs. enum will at least be done today, if not both.


awesome, thanks! I am trying it. and I have another idea. There is no code generated, no code compiled. CustomClass and CustomEnum are defined in a special Editor Window, it can save as a asset like Macro.everything is asset, no code, then I can make a game without coding one line. It's real visual scripting! But in current frame, maybe some native support and new features need to added.


well you don't need to code a lick with this either. It outputs it so it can be read as a true enum type. But you don't actually modify it, unless you want to. If it didn't read as a true enum though, Bolt itself couldn't read it as one, unfortunately that's all on Lazlo, as I can only modify the source for myself, and not redistribute. I'm currently mowing over the idea in loading a list of all enum to be parsed back to the unit on selection. But that wouldn't be for a bit till I finish the Struct one too. I'll try to sneak that in a few days. 

Maybe this will be more up your alley about handling c# principles in Bolt, but this is a long term project that could very well not be ready till this time next year. But I will be taking testers early once everything works congruently. I've posted on discord before, but it's called Continuum. Intended to be developed with Bolt API, but going lower level. It's essentially my equivalent to Nottorus for Bolt. Emphasis on ease of use just how Bolt is though.  Interfaces, Enum, Structs, Classes would be all be built how your asking kinda, still script generated, but you wouldn't need be concerned with anything code yourself. Reason being interaction directly with Bolt like you normally add third party. 

I've contemplated the idea of doing it runtime too, but that is for another time.

Last but not least I'm also working on something more for sooner, but that will also probably be paid. But extremely fair, as it's my first time selling a plugin. It's Flow Type machines and macros. Setup variables, methods, in a macro, and include a base type that copies an instance of that to the new one. It essentially componentizes machines how monobehaviour would be used with a bit of inheritance. All visual, zero code. But it's utilizing FlowGraphs still, so I don't have to do all the crazy stuff by scratch.

I like you lol I need more people who are just as interested in using visual scripting this way. I'm so determined, because the only asset that ever did this, was too expensive and lacked much of any public support. This needs to exist in Unity. 


(Sorry for the bump/necro, I'm doing some roadmap grooming following the Unity acquisition!)

This is now supported in Bolt 2 Alpha, via the class system, which is exactly what this request was about!