In the intervening time (years). CUDLR has become ‘deprecated’, it’s no longer being supported and there’s a few things we added to it anyway so. Let’s review the landscape again.

  • https://github.com/DylanYasen/unity-console
  • https://github.com/yasirkula/UnityIngameDebugConsole
  • https://github.com/stillwwater/command_terminal
  • https://github.com/mikelovesrobots/unity3d-console
  • https://github.com/gzuidhof/GConsole
  • https://github.com/pointcache/Unity3d-BeastConsole

A more crowded field but none doing exactly all the things I wanted. So we strip this back, re-org, let’s see what we have.

Ideally, I’d like to build directly off something existing like javascript, or lua, etc. Using Jint or Moonsharp. And both of those are actually very pleasant to do. Our refactor was very useful here, the DevConsole, the uGUI part required not changes just the binding class to route the call to the lua instance (Using FungusLua, which is MoonSharp) But I hit my head against the same problem in both of them, it’s the tab completion. They are introspective but not across interop, at least not simply or obviously. So I can add a c# object or static functions etc. to them but my autocomplete will not populate for them. For example exposing Time to lua, will show that there is an object called Time in auto completion but not any of its sub elements.

But that’s fine, we’ll return to the script execution desire at a later date. Our requirements haven’t really changed and it all still works, but with CUDLR being over, I don’t want to be maintaining the web side of it on my own.

What we want is Time.timeScale 1 to execute, autocomplete and maybe populate a help message. A single console/terminal, UI as a separate concern to the command storage, binding, and execution. Simple binding of static methods static variables objects, and bind object instance fields, props and members under a container. We’d already built up a lot on top of CUDLR, type binding, and uGUI interface, so we get rid of the server and all the supporting elements and were still running and not really CUDLR anymore.

At present we’re hiding the conversion checks inside the binding function and we’re using object boxing to have a generic in and out. We could use hardwiring or perhaps c#’s upcoming code generators to clean this up in the future.

This is meant for unity, so I wanted to try using UPM. Unity’s package manager has support for adding a required package via giturl and there’s a great guide here talking through the setup and automation of the conversion to the layout that Unity expects. Working as an embedded package, was recommended for development as you get the ‘same’ results as users of the package. If trying this yourself be aware that there is some fiddlyness in the initial setup, folder names, and which parts of the package.json are required to load required some manual file changes as Unity may unload them if it thinks they are not configured correctly. Similarly if an assembly within a package fails to compile it appears to be able to do so silently.

Its live on github https://github.com/stevehalliwell/Hug with instructions for using via UPM. There’s certainly more to do, it’s still in development, if you try it out and find bugs or have suggestions I’d love to hear them in the Issues section on github.