Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pjc0247/UniScript
Bring C# scripting into Unity which acts as native code.
https://github.com/pjc0247/UniScript
compiler csharp interpreter unity
Last synced: 29 days ago
JSON representation
Bring C# scripting into Unity which acts as native code.
- Host: GitHub
- URL: https://github.com/pjc0247/UniScript
- Owner: pjc0247
- Created: 2019-04-04T13:34:24.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2022-06-21T13:13:03.000Z (almost 2 years ago)
- Last Synced: 2024-02-09T09:41:07.638Z (4 months ago)
- Topics: compiler, csharp, interpreter, unity
- Language: C#
- Homepage:
- Size: 118 MB
- Stars: 151
- Watchers: 12
- Forks: 21
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
Lists
- awesome-stars - UniScript
- awesome-unity-open-source-on-github - UniScript - Brings C# scripting into Unity which acts as native code (Script Utility)
- awesome-unity3d - UniScript - Brings C# scripting into Unity which acts as native code. (Open Source Repositories / Scriptings)
- awesome-opensource-unity - UniScript - Brings C# scripting into Unity which acts as native code. (Open Source Packages / Scriptings)
- awesome - pjc0247/UniScript - Bring C# scripting into Unity which acts as native code. (C\#)
README
Brings C# scripting into Unity which acts as native code.
Documentation / Web PlaygroundOverview
----
```cs
var src = @"
class PlayerMovement : MonoBehaviour {
public void MoveForward() {
transform.position += new Vector3(0, 0, 1);
}
}
";var script = CScript.CreateRunner(src);
dynamic move = script
.Override("PlayerMovement", this)
.AsDynamic();
move.MoveForward();
```Yet Another C# Scripting Engine
---
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!Supports Unity's native messages
----
Unity messages will be fired automatically, same as Native C#.
```cs
class MoveForward : UniScriptBehaviour {
public void Update() {
transform.position += new Vector3(0, 0, 1);
}
public void OnEnable() { }
public void OnDisable() { }
}
```
One only difference is all callbacks should be declared as public.True Hot Reloading
----
Allows you to replace methods after parsing. This also affects already instantiated objects.
```cs
var r = CScript.CreateRunner(@"
class Foo { public int GiveMeNumber() => 10; }
");var foo = r.Instantiate("Foo");
// should be 10
foo.Invoke("GiveMeNumber");
```
```cs
ss.UpdateMethodsOnly(@"
class Foo { public int GiveMeNumber() => 20; }
");
// should be 20
foo.Invoke("GiveMeNumber");
```Runtime Debugging
----LICENSE
----
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.