{"id":18397141,"url":"https://github.com/hecomi/urepl","last_synced_at":"2025-04-12T14:18:54.189Z","repository":{"id":43088120,"uuid":"45727119","full_name":"hecomi/uREPL","owner":"hecomi","description":"In-game powerful REPL environment for Unity3D.","archived":false,"fork":false,"pushed_at":"2022-02-11T10:02:22.000Z","size":1974,"stargazers_count":556,"open_issues_count":7,"forks_count":54,"subscribers_count":29,"default_branch":"master","last_synced_at":"2025-04-12T14:18:48.603Z","etag":null,"topics":["c-sharp","repl","unity"],"latest_commit_sha":null,"homepage":"http://tips.hecomi.com/entry/2015/12/05/003000","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hecomi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-11-07T07:32:22.000Z","updated_at":"2025-04-04T09:00:44.000Z","dependencies_parsed_at":"2022-09-19T17:45:11.697Z","dependency_job_id":null,"html_url":"https://github.com/hecomi/uREPL","commit_stats":null,"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hecomi%2FuREPL","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hecomi%2FuREPL/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hecomi%2FuREPL/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hecomi%2FuREPL/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hecomi","download_url":"https://codeload.github.com/hecomi/uREPL/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248578876,"owners_count":21127714,"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":["c-sharp","repl","unity"],"created_at":"2024-11-06T02:16:00.216Z","updated_at":"2025-04-12T14:18:54.141Z","avatar_url":"https://github.com/hecomi.png","language":"C#","readme":"uREPL\n=====\n\nuREPL is an in-game powerful REPL environment for Unity3D that supports following functions:\n\n- Any Unity-supported C# code evaluation at run time.\n- Emacs-like keyboard shortcuts.\n- Multi-Line input.\n- Customizable completions.\n- Command definition just by adding an attribute.\n- *GameObject* and *Component* inspector.\n- Output logs.\n- History.\n\n\nDemo\n----\n\u003ca href=\"http://www.youtube.com/watch?feature=player_embedded\u0026v=0eNvSF6mfnk\" target=\"_blank\"\u003e\n\t\u003cimg src=\"https://raw.githubusercontent.com/wiki/hecomi/uREPL/images/demo.png\"\n\t\talt=\"uREPL - In-game powerful REPL environment for Unity3D - YouTube\"\n\t\twidth=\"720\"\n\t\theight=\"420\" /\u003e\n\u003c/a\u003e\n\n\nEnvironment\n-----------\n\n- Mac / Windows\n- Unity 2017.x .NET 4.6 (from v0.5.0)\n    - Unity 5.x .NET 3.5 (until v0.4.0)\n\n\nInstall\n-------\n\n- Unity Package\n  - Download the latest .unitypackage from [Release page](https://github.com/hecomi/uREPL/releases).\n- Git URL (UPM)\n  - Add `https://github.com/hecomi/uREPL.git#upm` to Package Manager.\n- Scoped Registry (UPM)\n  - Add a scoped registry to your project.\n    - URL: `https://registry.npmjs.com`\n    - Scope: `com.hecomi`\n  - Install uREPL in Package Manager.\n\n\nUsage\n-----\n\n1. Select menu from `Assets \u003e Create \u003e uREPL` to instantiate a `uREPL` prefab.\n2. If you have no `EventSystem`, add it from `Hierarchy \u003e Create \u003e UI \u003e EventSystem`.\n3. Input the code into the input filed, then press the Enter key to submit and evaluate it.\n\n\nKeybinds\n--------\n\n### Input\n| Key                       | Description                                  |\n| ------------------------- | -------------------------------------------- |\n| `ctrl + a`                | move to head.                                |\n| `ctrl + e`                | move to end.                                 |\n| `ctrl + f`, `right arrow` | move forward.                                |\n| `ctrl + b`, `left arrow`  | move back.                                   |\n| `ctrl + h`, `backspace`   | remove character before cursor position.     |\n| `ctrl + d`                | remove character after cursor position.      |\n| `ctrl + k`                | remove all characters after cursor position. |\n| `ctrl + l`                | clear all outputs.                           |\n| `ctrl + m`                | toggle single-line / multi-line mode.        |\n| `ctrl + n`, `up arrow`    | show next history.                           |\n| `ctrl + p`, `down arrow`  | show previous history.                       |\n| `ctrl + tab`              | show completions.                            |\n| `enter`                   | run input command.                           |\n| `F1`                      | toggle window display on/off.                |\n\n### Completion\n| Key                       | Description                                  |\n| ------------------------- | -------------------------------------------- |\n| `ctrl + n`, `up arrow`    | select lower item.                           |\n| `ctrl + p`, `down arrow`  | select upper item.                           |\n| `tab`, `enter`            | insert selected completion.                  |\n| `esc`                     | hide completions.                            |\n\n\nCommands\n--------\n\n### Attribute\n\nYou can add commands by adding a `[uREPL.Command]` attribute to static methods.\n\n```cs\npublic class CommandTest\n{\n\t// Given from somewhere.\n\tstatic public GameObject gameObject;\n\n\t// This method can be called without class name.\n\t// $ ShowCurrentSelectedObject() ⏎\n\t[uREPL.Command]\n\tstatic public string ShowCurrentSelectedObject()\n\t{\n\t\treturn gameObject.name;\n\t}\n\n\t// This method can be called by the given name.\n\t// $ selected ⏎\n\t[uREPL.Command(name = \"selected\")]\n\tstatic public string ShowCurrentSelectedObject2()\n\t{\n\t\treturn gameObject.name;\n\t}\n\n\t// Completion view show the given description.\n\t[uREPL.Command(name = \"selected2\", description = \"show the selected gameobject name.\")]\n\tstatic public string ShowCurrentSelectedObject3()\n\t{\n\t\treturn gameObject.name;\n\t}\n}\n```\n\n### Command with arguments\n\nuREPL automatically convert the command format into the actual code.\n\n```cs\npublic class CommandTest\n{\n\t// '$ print \"\\\"hoge hoge\\\"\" ⏎' will be replaced with:\n\t// CommandTest.Print(\"\\\"hoge hoge\\\"\");\n\t[uREPL.Command(name = \"print\")]\n\tstatic public void Print(object obj)\n\t{\n\t\tDebug.Log(obj);\n\t}\n\n\t// Supports an overloaded command.\n\t[uREPL.Command(name = \"print\")]\n\tstatic public void Print(string value1, int value2, float value3)\n\t{\n\t\tDebug.LogFormat(\"string: {0}, int: {1}, float: {2}\", value1, value2, value3);\n\t}\n}\n```\n\n### Runtime\n\nFrom v0.4.0, you can register and unregister commands in runtime.\n\n```cs\nusing UnityEngine;\n\npublic class RuntimeCommandTest : MonoBehaviour\n{\n    void OnEnable()\n    {\n        uREPL.RuntimeCommands.Register(\"func1\", () =\u003e Debug.Log(\"hoge\"), \"output hoge\");\n        uREPL.RuntimeCommands.Register(\"func2\", x =\u003e Debug.Log(x), \"outout given argument\");\n        uREPL.RuntimeCommands.Register(\"func3\", (x, y) =\u003e Debug.Log((int)x * (int)y), \"multiply arg0 by arg1\");\n        uREPL.RuntimeCommands.Register(\"func4\", (x, y, z) =\u003e Debug.Log(x + \" \" + y + \" \" + z), \"output all arguments\");\n        uREPL.RuntimeCommands.Register(\"func5\", (int x) =\u003e Debug.Log(x), \"output int value\");\n        uREPL.RuntimeCommands.Register(\"func6\", (string x, float y) =\u003e Debug.Log(x + \" is \" + y), \"output arg0 is arg1\");\n        uREPL.RuntimeCommands.Register(\"func7\", (Vector3 pos, Quaternion rot, Vector3 scale) =\u003e Debug.Log(pos + \" \" + rot + \" \" + scale), \"output unity-type values.\");\n    }\n\n    void OnDisable()\n    {\n        uREPL.RuntimeCommands.Unregister(\"func1\");\n        uREPL.RuntimeCommands.Unregister(\"func2\");\n        uREPL.RuntimeCommands.Unregister(\"func3\");\n        uREPL.RuntimeCommands.Unregister(\"func4\");\n        uREPL.RuntimeCommands.Unregister(\"func5\");\n        uREPL.RuntimeCommands.Unregister(\"func6\");\n        uREPL.RuntimeCommands.Unregister(\"func7\");\n    }\n}\n```\n\n- If types are omitted, they become `System.Object`.\n- If types are given, arguments are automatically converted into them, and output an error if it failed.\n- You cannot use overload.\n- At most 3 arguments now.\n\n\n### Built-in Commands\n- help\n  - show keybinds.\n- commands\n  - show all commands.\n- close\n  - close uREPL window.\n- exit\n  - exit game.\n\n\nCompletion\n----------\nuREPL supports three completion methods by default:\n\n- Context\n- Command\n- *GameObject* name / path\n\nYou can add completion plugins by adding a class that inherits from `uREPL.CompletionPlugin` and overrides `GetCompletions()`.\nThis class is derived from `MonoBehaviour`, so you can collect information using its callbacks.\nThe following code is a sample for *GameObject* name completion.\n\n```cs\nusing UnityEngine;\nusing System.Linq;\nusing uREPL;\n\npublic class SampleCompletion : CompletionPlugin\n{\n\tstring[] gameObjectNames_;\n\n\tpublic void Update()\n\t{\n\t\tgameObjectNames_ = GameObject.FindObjectsOfType\u003cGameObject\u003e()\n\t\t\t.Select(go =\u003e go.name)\n\t\t\t.ToArray();\n\t}\n\n\t// This method is called from a non-main thread.\n\t// If you want to use such as GameObject-related data, please get it in the main thread.\n\tpublic override CompletionInfo[] GetCompletions(string input)\n\t{\n\t\tvar partialName = input.Substring(input.LastIndexOf(\"\\\"\") + 1);\n\t\treturn gameObjectNames_\n\t\t\t.Where(name =\u003e name.IndexOf(partialName) != -1)\n\t\t\t.Select(name =\u003e new CompletionInfo(partialName, name, \"G\", Color.red))\n\t\t\t.ToArray();\n\t}\n}\n```\n\n\nLogs\n----\nYou can output 3 level logs by `uREPL.Log.Output(string)`, `uREPL.Log.Warn(string)`,\nand `uREPL.Log.Error(string)`.\n\n```cs\nstatic public class LogTest\n{\n\tstatic public void ShowLogs()\n\t{\n\t\tuREPL.Log.Output(\"this is normal log.\");\n\t\tuREPL.Log.Warn(\"this is warning log.\");\n\t\tuREPL.Log.Error(\"this is error log.\");\n\t}\n}\n```\n\n\u003cimg src=\"https://raw.githubusercontent.com/wiki/hecomi/uREPL/images/log.png\"\n\talt=\"log examples\"\n\twidth=\"720\"\n\theight=\"405\" /\u003e\n\n\nInspector\n---------\nYou can inspect *GameObject* by calling `GameObject.Inspect()`. This shows position, rotation, scale, and components added to it.\n\n\u003cimg src=\"https://raw.githubusercontent.com/wiki/hecomi/uREPL/images/gameobject_inspector.png\"\n\talt=\"gameobject inspector\"\n\twidth=\"720\"\n\theight=\"405\" /\u003e\n\nYou can also inspect *Component* by clicking the inspect icon or calling `Component.Inspect()`.\n\n\u003cimg src=\"https://raw.githubusercontent.com/wiki/hecomi/uREPL/images/component_inspector.png\"\n\talt=\"component inspector\"\n\twidth=\"720\"\n\theight=\"405\" /\u003e\n\nSee the following videos for more details:\n- [GameObject Inspect video](https://www.youtube.com/watch?v=CF3S3TsJajU)\n- [Component Inspect video](https://www.youtube.com/watch?v=WdfmlPrrxX0)\n\n\nMulti-Line\n----------\nToggle single-line and multi-line modes by `Ctrl-m` or clicking the right-top icon in the input area.\n\n\u003cimg src=\"https://raw.githubusercontent.com/wiki/hecomi/uREPL/images/multiline.png\"\n\talt=\"multiline mode\"\n\twidth=\"720\"\n\theight=\"405\" /\u003e\n\nOthers\n------\n- World Space GUI\n  - Set the `Render Mode` of the `Canvas` component as `World Space`.\n- Multiple GUI\n  - You can locate multiple GUIs in a scene.\n- Builds\n  - Almost all functions are available even in the built binary.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhecomi%2Furepl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhecomi%2Furepl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhecomi%2Furepl/lists"}