
Brings C# scripting into Unity which acts as native code.
Documentation/Web Playground
varsrc=@"class PlayerMovement : MonoBehaviour { public void MoveForward() { transform.position += new Vector3(0, 0, 1); }}";varscript=CScript.CreateRunner(src);dynamicmove=script.Override("PlayerMovement",this).AsDynamic();move.MoveForward();Other C# scripts use mcs or roslyn. They're all compiler based not an interpreter
however UniScript uses a SlowSharp as a backend
which enables....
- Sandboxing : Can prevent malicious call with Whitelist, Blacklist or your own rules.
- Fully compatible with iOS, WebAssembly and WSA : iOS is a huge market you can't abandon.
- Execution timeout to prevent infinite loops : More safety on user created mods!
Unity messages will be fired automatically, same as Native C#.
classMoveForward:UniScriptBehaviour{publicvoidUpdate(){transform.position+=newVector3(0,0,1);}publicvoidOnEnable(){}publicvoidOnDisable(){}}One only difference is all callbacks should be declared as public.
Allows you to replace methods after parsing. This also affects already instantiated objects.
varr=CScript.CreateRunner(@"class Foo { public int GiveMeNumber() => 10; }");varfoo=r.Instantiate("Foo");// should be 10foo.Invoke("GiveMeNumber");ss.UpdateMethodsOnly(@"class Foo { public int GiveMeNumber() => 20; }");// should be 20foo.Invoke("GiveMeNumber");It doesn't have clear license at this moment, becuase this is very early stage of development and I'm not yet determined to sell this product or not.
So just keep below lines.
- Non-Commercial/Commercial use are allowed.
- Sourcecode redistribution with chainging its name is not allowed.
However, SlowSharp has its own license and you may publish code with some modifications.
