{"id":25975046,"url":"https://github.com/pjc0247/uniscript","last_synced_at":"2025-03-05T02:36:36.892Z","repository":{"id":34799832,"uuid":"179503929","full_name":"pjc0247/UniScript","owner":"pjc0247","description":"Bring C# scripting into Unity which acts as native code.","archived":false,"fork":false,"pushed_at":"2022-06-21T13:13:03.000Z","size":123572,"stargazers_count":155,"open_issues_count":3,"forks_count":22,"subscribers_count":12,"default_branch":"master","last_synced_at":"2025-03-02T20:52:10.748Z","etag":null,"topics":["compiler","csharp","interpreter","unity"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pjc0247.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-04-04T13:34:24.000Z","updated_at":"2025-01-02T03:57:35.000Z","dependencies_parsed_at":"2022-09-18T09:20:27.312Z","dependency_job_id":null,"html_url":"https://github.com/pjc0247/UniScript","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pjc0247%2FUniScript","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pjc0247%2FUniScript/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pjc0247%2FUniScript/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pjc0247%2FUniScript/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pjc0247","download_url":"https://codeload.github.com/pjc0247/UniScript/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241955010,"owners_count":20048402,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["compiler","csharp","interpreter","unity"],"created_at":"2025-03-05T02:36:36.381Z","updated_at":"2025-03-05T02:36:36.880Z","avatar_url":"https://github.com/pjc0247.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n\u003cimg src=\"uniscript.png\" /\u003e\u003cbr\u003e\nBrings C# scripting into Unity which acts as native code.\u003cbr\u003e\n    \u003ca href=\"docs/\"\u003eDocumentation\u003c/a\u003e \u003cb\u003e/\u003c/b\u003e \u003ca href=\"https://pjc0247.github.io/UniScript/uniplayground/\"\u003eWeb Playground\u003c/a\u003e\n\u003c/p\u003e\n\nOverview\n----\n```cs\nvar src = @\"\nclass PlayerMovement : MonoBehaviour {\n    public void MoveForward() {\n        transform.position += new Vector3(0, 0, 1);\n    }\n}\n\";\n\nvar script = CScript.CreateRunner(src);\n\ndynamic move = script\n    .Override(\"PlayerMovement\", this)\n    .AsDynamic();\nmove.MoveForward();\n```\n\nYet Another C# Scripting Engine\n---\nOther C# scripts use `mcs` or `roslyn`. They're all compiler based not an interpreter\u003cbr\u003e\nhowever UniScript uses a __SlowSharp__ as a backend\u003cbr\u003e\nwhich enables....\n* __Sandboxing__ : Can prevent malicious call with Whitelist, Blacklist or your own rules.\n* __Fully compatible with iOS, WebAssembly and WSA__ : iOS is a huge market you can't abandon.\n* __Execution timeout to prevent infinite loops__ : More safety on user created mods!\n\nSupports Unity's native messages\n----\nUnity messages will be fired automatically, same as Native C#.\n```cs\nclass MoveForward : UniScriptBehaviour { \n    public void Update() {\n        transform.position += new Vector3(0, 0, 1);\n    }\n    public void OnEnable() { }\n    public void OnDisable() { }\n}\n```\nOne only difference is all callbacks should be declared as public.\n\nTrue Hot Reloading\n----\nAllows you to replace methods after parsing. This also affects already instantiated objects. \n```cs\nvar r = CScript.CreateRunner(@\"\nclass Foo { public int GiveMeNumber() =\u003e 10; }\n\");\n\nvar foo = r.Instantiate(\"Foo\");\n// should be 10\nfoo.Invoke(\"GiveMeNumber\");\n```\n```cs\nss.UpdateMethodsOnly(@\"\nclass Foo { public int GiveMeNumber() =\u003e 20; }\n\");\n// should be 20\nfoo.Invoke(\"GiveMeNumber\");\n```\n\n\nRuntime Debugging\n----\n\u003cimg src=\"debug.png\" /\u003e\n\nLICENSE\n----\nIt 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.\u003cbr\u003e\nSo just keep below lines.\n\n* Non-Commercial/Commercial use are allowed.\n* Sourcecode redistribution with chainging its name is not allowed.\n\nHowever, __SlowSharp__ has its own license and you may publish code with some modifications.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpjc0247%2Funiscript","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpjc0247%2Funiscript","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpjc0247%2Funiscript/lists"}