#UnityAtoms

The cleanup for the Ink - Atoms utility is coming along pretty well. I've already tested it in a couple of projects and ironed out the annoying parts. It's now more a matter of UI than anything else. #gamedev #ink #UnityAtoms

A Unity inspector showing the following entries:
Main Ink File (the .ink file - do not put the compiled .json file in this field. This field is only used in the editor.)
Atoms:
- Story Step Variable
- Continue Event
- Choice Event
- Ink Story Atoms Initialized Variable
Check syntax button
Debug Current State check
Variable Listeners (closed foldout)
External Functions (closed foldout)
Command Line Parsers (closed foldout)
Command Line Prefix (set to ">>> ")
Tag Processors (closed foldout)Same as previous screenshot, but with the focus on the opened foldouts.
Variable Listeners has four entries.
First entry has Match set to Name, Name set to var1, Variable set to an Atom. Second entry has Match set to Regular Expression, Regex set to "var[0-9]", and an explanation text specifying "matching: var1, var2, var3", Varaible Pair Change Event set to an Event and Variable Change Event set to nothing. Third entry has Match set to List, Variable list set to var1 and var3, Variable Pair Change Event set to an event, and Variable Change Event set to nothing. Fourth entry has Match set to Name (ink list), Name set to testList, and Value List set to an Atom.
External functions has two entries ("Test 1 Play Sound" and "Wait").
Command Line Parsers has two entries ("Test 1 Play Sound" and "Random Choice Command").
Tag Processors has one entry ("Test 1 Play Sound").

Ok, I've been able to run #ink external functions as asynchronous, with some trickery of a separate thread for running the ink engine and a couple of command queues to make commands execute in the right place.

Also added some more stuff used in other projects to integrate it with #UnityAtoms .

Will probably use for the #inkjam23!

(interface is still messy though, I'll probably work some #UIToolkit magic)

public override IEnumerator Call(ExternalFunctionContext context)
{
    if (audioPlayer == null) {
        Debug.LogError("no audio player in scene");
    }
    var soundName = context.Arguments[0] as string;
    var duration = audioPlayer.Play(soundName);
    yield return new WaitForSeconds(duration);
    context.Result = duration;
}

Client Info

Server: https://mastodon.social
Version: 2025.04
Repository: https://github.com/cyevgeniy/lmst