Custom Variables: Part 2 — The Unsung Sidekicks
Last time, we cracked open the history and mystery of Flowchart Variables. Today, we meet their quieter, less glamorous partners: VariableDatas.


Quite. They're the reason that you can use a Flowchart Variable as an input for a Command. For example, the Intro and Outro Clips in MA Play Audio.

See how Intro Clip has a hard null value while Main Clip is set to a var named bgm? Without VariableDatas, you'd always have to "hard-code" the inputs.




Yes, hard-coding as the only option makes things extra time-consuming. With VariableDatas, you'd just assign the song to one variable, have that used in the Play Audios, and then simply change that variable's value when you get a new version of the song.

Yes, the DMV could stand to learn a thing or two from them.
The Old Fungus Way
In Fungus, every VariableData struct had to carry the same boilerplate:
- A reference to a Variable
- A raw value
- Conversion logic
- A
GetDescription()method.
That meant tons of duplication. Every new type meant another wall of copy‑pasted code, and if you wanted to add your own type, you had to dive into the source and repeat the ritual.

Every codebase gets such at some point or several, ours included. Did it work here? Yes. Was it brittle, repetitive and closed off to extension?

Amanita’s Way
In Amanita, we gave these sidekicks a makeover. Instead of each one reinventing the wheel, they all inherit from a generic base class. The base handles references, values, and conversions. Thus, subclasses don't have to bring as many of their own utensils.

Exactly. Much like with Variables, you don’t need to dig into the internals anymore. Define your new type, add a sprinkle of boilerplate, and you’re done. For the curious, here’s a side‑by‑side of the old and new approaches: https://gist.github.com/CG-Tespy/eb8788bf0a6975b07a927d958b30a21c

Harmony restored with the OCP too.
Finally...
VariableDatas may not be flashy, but they’re the glue that makes Variables work so nicely with Commands. In Fungus, they were a bit on the scattered side. In Amanita, they’re more unified, elegant, and future‑proof.

A hale hearty helping of visual rendering!

Amanita
Toolkit for making Games with Unity
| Status | In development |
| Category | Tool |
| Author | AtelierMycelia |
| Genre | Visual Novel |
| Tags | 2D, Point & Click, storygame, Unity |
More posts
- ✨ Custom Variables: Part 3 — The Variable Window's New Groove ✨62 days ago
- Custom Variables: Part 1 — The Old Way vs. Amanita’s Way94 days ago
- Save/Load Magic: Part 4Aug 20, 2025
- Save/Load Magic: Part 3Aug 08, 2025
- Save/Load Magic: Part 2Aug 01, 2025
- Save/Load Magic: Part 1Jul 21, 2025
- Hitting Pause for a Little Variable TLCJul 14, 2025
- Saving Flowcharts, Variables, and Blocks, Oh My!Jul 07, 2025
Leave a comment
Log in with itch.io to leave a comment.