This is the official discussion thread for MiniScript (continuing from the old work-in-progress thread which is now locked).
MiniScript is a lightweight*,* simple-but-sophisticated scripting language implemented in plain C#. It is very easy to integrate into your Unity game, enabling things like modding or runtime scripting.
I’m passionate about MiniScript, and support my users enthusiastically. Use this thread (or our Discord server if preferred) to ask questions, show off what you’re working on, or otherwise share with the MiniScript community, and I will get back to you ASAP!
I’m very interested in implementing scripting in Unity this - so cloned the GitHub repo, copied what I think are the right files into a Unity project’s asset folder, copy and pasted some code from the Miniscript Unity Integration Guide - and kinda got stuck there…
what I would find really useful is a step by step what to put where, with a new empty Unity project - maybe with a script that moves a cube around or something really simple.
I’m reluctant to buy the Asset from the asset store at teh moment as I can’t really see how to get it working simply - and I’m not sure if the asset version would make it any easier?
Well it definitely would, because the asset includes several sample scenes that do exactly that. This includes the source code for this demo as well as a (slightly older/simpler) version of Robo Reindeer Rumble.
It should be possible to get going with just the Integration Guide, however. Chapter 2 shows how to get data in and out of a script, by accessing the script’s globals or by adding custom intrinsic functions. So you just do that, in Update or FixedUpdate of a MonoBehaviour, tying some of that data to (say) the position of a cube.
Why don’t you post more info about where you are stuck, and I’ll see if I can help? Or for faster help, join the MiniScript Discord server; we have a whole channel (#embedders) dedicated to people embedding MiniScript in other apps.
Support and discussion of MiniScript has mostly moved into the Discord server, which is quite active, as well as the forums (somewhat less so). But questions/comments are still quite welcome here.
I have a request myself: if you are using MiniScript in a product, and there is any published article, blog post, press release, etc. about that product, could you please let me know? If it mentions MiniScript then I will want to include it in this wiki page, and eventually it may become a citation in Wikipedia.
The addition of “math-assignment operators” (+=, -=, etc.) is a fairly common feature request. Enough so that I’m now on the fence about whether to add them to the language.
Please see this blog post, and at the bottom, use the survey form to let me know what you think!
Is there any chance you might eventually migrate ValMap away from the Dictionary type in C#?
I tried to set up some simple Unity bots controlled by miniscript (using the Asset Store version) and found it had regular major Garbage Collection hitches making it unsuitable for my concept. After some deep profiling I kept coming back to the ValMap use of Dictionary as the probable cause.
I wrote overloads to reuse existing Dictionary objects where possible, but this only reduced the frequency.
Unfortunately, when using Unity objects ValMap seems like the only suitable option for Vector3 and Quaternion data exchanges.
You can make a “ValWrapper” class to let you wrap arbitrary internal C# classes, or similar custom Value subclasses for struct types like Vector3 and Quaternion. Making those as pleasant to use as a map would be a lot of work, but it may be worth it if you’re dealing with a lot of vectors and quaternions in your code.
For ValWrapper, look at the source code to the Farmtronics plugin, specifically the very bottom of M1API.cs at Farmtronics/Farmtronics/M1/M1API.cs at main · JoeStrout/Farmtronics · GitHub . Mini Micro uses the same ValWrapper to wrap things like AudioClip and Texture2D (presented to the user as Sound and Image, respectively).
For making a custom Vector or Quaternion type that avoids the map, probably better catch me on discord (you can find the link at https://miniscript.org), and we’ll work on it together. However there is still going to be some garbage, as all MiniScript Values are C# objects. In my projects, though, it hasn’t been a problem. Again, catch me on Discord and maybe we can figure out together what’s going on in your case.
Thanks @SynapticBytes ! There has indeed been a lot going on with MiniScript, though I haven’t been super active about updating this thread. So your weekly updates will be really helpful!
I missed posting last week’s roundup, and I also have this week’s, which is the Christmas edition. So here’s the links for the two articles, for those who’d like to catch up.
I’m fighting off a head cold this week. Don’t you hate it when you feel sick and miserable, but not sick enough, that you feel guilty if you just lie around doing nothing? Here’s this week’s news.