{"id":13731048,"url":"https://github.com/mob-sakai/OpenSesameCompilerForUnity","last_synced_at":"2025-05-08T03:32:52.222Z","repository":{"id":41081433,"uuid":"230019969","full_name":"mob-sakai/OpenSesameCompilerForUnity","owner":"mob-sakai","description":"A Roslyn compiler to access internals/privates for Unity. In other words, you can access to any internals/privates in other assemblies, without reflection. Let's say, \"Open sesame!\"","archived":false,"fork":false,"pushed_at":"2020-10-06T13:34:54.000Z","size":415,"stargazers_count":105,"open_issues_count":1,"forks_count":7,"subscribers_count":8,"default_branch":"upm","last_synced_at":"2024-10-30T00:04:48.267Z","etag":null,"topics":["compiler","csharp","editor","internal","private","roslyn","unity","unity3d","upm-package"],"latest_commit_sha":null,"homepage":"https://github.com/mob-sakai/OpenSesameCompilerForUnity","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/mob-sakai.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":"mob-sakai","patreon":"mob_sakai","open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":null}},"created_at":"2019-12-25T00:57:17.000Z","updated_at":"2024-10-24T07:42:42.000Z","dependencies_parsed_at":"2022-08-31T01:10:40.885Z","dependency_job_id":null,"html_url":"https://github.com/mob-sakai/OpenSesameCompilerForUnity","commit_stats":null,"previous_names":[],"tags_count":52,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mob-sakai%2FOpenSesameCompilerForUnity","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mob-sakai%2FOpenSesameCompilerForUnity/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mob-sakai%2FOpenSesameCompilerForUnity/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mob-sakai%2FOpenSesameCompilerForUnity/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mob-sakai","download_url":"https://codeload.github.com/mob-sakai/OpenSesameCompilerForUnity/tar.gz/refs/heads/upm","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224319558,"owners_count":17291858,"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","editor","internal","private","roslyn","unity","unity3d","upm-package"],"created_at":"2024-08-03T02:01:23.213Z","updated_at":"2024-11-14T21:32:06.818Z","avatar_url":"https://github.com/mob-sakai.png","language":"C#","funding_links":["https://github.com/sponsors/mob-sakai","https://patreon.com/mob_sakai","https://www.patreon.com/join/mob_sakai?"],"categories":["C#"],"sub_categories":[],"readme":"Open Sesame Compiler For Unity\n===\n\n**:warning: NOTE: This project has been integrated into [CSharpCompilerSettingsForUnity](https://github.com/mob-sakai/CSharpCompilerSettingsForUnity). We are NOT continuing development in this repository. :warning:**\n\n\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\n\nA custom Roslyn compiler and editor extension to access internals/privates for Unity.  \nIn other words, you can access to **any internals/privates** in other assemblies, **without reflection**.\n\nLet's say, **\"Open sesame!\"**\n\n![](https://user-images.githubusercontent.com/12690315/71837979-255d0880-30fb-11ea-99bc-3bb96b77cfa6.gif)\n\n![](https://user-images.githubusercontent.com/12690315/70616819-a804bc00-1c52-11ea-8ea3-e24f94f6467d.gif)\n\n[![](https://img.shields.io/npm/v/com.coffee.open-sesame-compiler?label=openupm\u0026registry_uri=https://package.openupm.com)](https://openupm.com/packages/com.coffee.open-sesame-compiler/)\n[![](https://img.shields.io/github/v/release/mob-sakai/OpenSesameCompilerForUnity?include_prereleases)](https://github.com/mob-sakai/OpenSesameCompilerForUnity/releases)\n[![](https://img.shields.io/github/release-date/mob-sakai/OpenSesameCompilerForUnity.svg)](https://github.com/mob-sakai/OpenSesameCompilerForUnity/releases)\n![](https://img.shields.io/badge/unity-2018.3%20or%20later-green.svg)\n[![](https://img.shields.io/github/license/mob-sakai/OpenSesameCompilerForUnity.svg)](https://github.com/mob-sakai/OpenSesameCompilerForUnity/blob/upm/LICENSE.txt)\n[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-orange.svg)](http://makeapullrequest.com)\n[![](https://img.shields.io/twitter/follow/mob_sakai.svg?label=Follow\u0026style=social)](https://twitter.com/intent/follow?screen_name=mob_sakai)\n\n\u003c\u003c [Description](#description) | [Installation](#installation) | [Usage](#usage) | [Contributing](#contributing) \u003e\u003e\n\n### What's new? [See changelog ![](https://img.shields.io/github/release-date/mob-sakai/OpenSesameCompilerForUnity.svg?label=last%20updated)](https://github.com/mob-sakai/OpenSesameCompilerForUnity/blob/upm/CHANGELOG.md)\n### Do you want to receive notifications for new releases? [Watch this repo ![](https://img.shields.io/github/watchers/mob-sakai/OpenSesameCompilerForUnity.svg?style=social\u0026label=Watch)](https://github.com/mob-sakai/OpenSesameCompilerForUnity/subscription)\n### Support me on GitHub!  \n[![become_a_sponsor_on_github](https://user-images.githubusercontent.com/12690315/66942881-03686280-f085-11e9-9586-fc0b6011029f.png)](https://github.com/users/mob-sakai/sponsorship)\n\n\n\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\n## Description\n\n\u003e _Then Ali Baba climbed down and went to the door concealed among the bushes, and said, \"Open, Sesame!\" and it flew open._\n\nThis package allows to access to **any internals/privates** in other assemblies, **without reflection**.  \n\nFor details about `IgnoresAccessChecksToAttribute`, see \n[No InternalsVisibleTo, no problem – bypassing C# visibility rules with Roslyn](https://www.strathweb.com/2018/10/no-internalvisibleto-no-problem-bypassing-c-visibility-rules-with-roslyn/).\n\n\n#### Features\n\n* Easy to use\n  * this package is out of the box.\n* Allow to access to any internal/private elements (types/members) in other assemblies, **without reflection**\n  * Create instance\n  * Get/set fields or properties\n  * Call method\n  * Create extension method that contains private access\n  * etc.\n* Processes only `AssemblyDefinitionFile` you configured\n* Add/remove the scripting define symbols for each `AssemblyDefinitionFiles`\n* Support C#8\n* Support `.Net 3.5`, `.Net 4.x` and `.Net Standard 2.0`\n* `dotnet` is not required\n* Publish as dll\n  * Published dll works **without this package**.\n* Portable mode\n  * Without publishing, make the assembly available to access to internals/privates in other assemblies, even in projects that do not have this package installed.\n  * The best option when distributing as a package.\n\n#### NOTE: Unsupported Features\n\n* Set/get value into readonly field\n  * Use reflection\n* IDE support\n  * Use [Csc-Manager](https://github.com/pCYSl5EDgo/Csc-Manager) to modify your [VisualStudio Code](https://code.visualstudio.com/download) and [C# extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode.csharp).\n    * `csc-manager enable-vscode`: Show internals/privates in other assembly.\n    * `csc-manager disable-vscode`: Hide them.\n\n\n\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\n## Installation\n\n#### Requirement\n\n* Unity 2018.3 or later\n\n#### Using OpenUPM\n\nThis package is available on [OpenUPM](https://openupm.com). \nYou can install it via [openupm-cli](https://github.com/openupm/openupm-cli).\n```\nopenupm add com.coffee.open-sesame-compiler\n```\n\n#### Using Git\n\nFind the `manifest.json` file in the `Packages` directory in your project and edit it to look like this:\n```json\n{\n  \"dependencies\": {\n    \"com.coffee.open-sesame-compiler\": \"https://github.com/mob-sakai/OpenSesameCompilerForUnity.git\",\n    ...\n  },\n}\n```\nTo update the package, change suffix `#{version}` to the target version.\n\n* e.g. `\"com.coffee.open-sesame-compiler\": \"https://github.com/mob-sakai/OpenSesameCompilerForUnity.git#1.0.0\",`\n\nOr, use [UpmGitExtension](https://github.com/mob-sakai/UpmGitExtension) to install and update the package.\n\n\n\n\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\n## Usage\n\n1. Select a `AssemblyDefinitionFile` in project view\n2. Configure setting for the assembly in inspector view:  \n![](https://user-images.githubusercontent.com/12690315/73439891-bab68a00-4393-11ea-9928-a286c9c3e6e0.png)\n   * **Open Sesame**: Use OpenSesameCompiler instead of default csc to compile this assembly. In other words, allow this assembly to access to internals/privates to other assemblies without reflection.\n   * **Settings**: how/hide the detail settings for this assembly.\n     * **Modify Symbols**: When compiling this assembly, add/remove semicolon separated symbols. Symbols starting with '!' will be removed.  \n     **NOTE: This feature is available even when 'Open Sesame' is disabled**\n     * **Portable Mode**: Make this assembly available to access in internals/privates to other assemblies, even in projects that do not have `Open Sesame Compiler` package installed.\n   * **Publish**: Publish this assembly as dll to the parent directory.\n   * **Help**: Open help page on browser.\n1. Enjoy!\n\n\n\n\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\n## Demo\n\n1. Clone demo branch in this repo and open it with Unity 2018.3 or later\n```\ngit clone -b demo https://github.com/mob-sakai/OpenSesameCompilerForUnity.git\n```\n2. The project has some inaccessible compilation errors  \n![](https://user-images.githubusercontent.com/12690315/71837690-6274cb00-30fa-11ea-949f-5f60b1a1dbcd.png)\n3. Do not worry, they are proper errors.  \nThe demo project access to internals/privates:\n```cs\n// EditorApplication.CallDelayed is an internal-static method in UnityEditor assembly.\nEditorApplication.CallDelayed(() =\u003e Debug.Log(\"delayed\"), 1);\n```\n4. Select `Assets/Tests/Coffee.OpenSesame.Test.asmdef` in project view and activate 'Open Sesame' in inspector view  \n![](https://user-images.githubusercontent.com/12690315/71837979-255d0880-30fb-11ea-99bc-3bb96b77cfa6.gif)\n5. Run all edit mode tests in test runner view (`Windows \u003e General \u003e Test Runner`).  \nThe compilation error is gone, but some tests that depend on symbols will not pass.  \n![](https://user-images.githubusercontent.com/12690315/71838489-483bec80-30fc-11ea-9af4-83e2ddd7d894.png)\n```cs\n[Test]\npublic void DefineSymbols()\n{\n    const string log = \"OSC_TEST is defined.\";\n    LogAssert.Expect(LogType.Log, log);\n#if OSC_TEST // \u003c- not defined!\n    Debug.Log(log);\n#endif\n}\n\n[Test]\npublic void RemoveSymbols()\n{\n    const string log = \"TRACE is not defined.\";\n    LogAssert.Expect(LogType.Log, log);\n#if !TRACE // \u003c- defined automatically by Unity!\n    Debug.Log(log);\n#endif\n}\n```\n6. Enable `symbols` to modify scripting define symbols for this assembly.  \nThen edit `Modify Symbols` to `OSC_TEST;!TRACE`. This means *\"add `OSC_TEST` symbol and remove `TRACE` symbol for this assembly.\"*  \n![](https://user-images.githubusercontent.com/12690315/71839029-9a314200-30fd-11ea-8596-d1a6ea188741.png)\n1. All tests pass!  \n![](https://user-images.githubusercontent.com/12690315/71839100-c2b93c00-30fd-11ea-86a7-a2f1aac0a4cc.png)\n\nFor more details, see [the article 1 (Japanese)](https://qiita.com/mob-sakai/items/f3bbc0c45abc31ea7ac0) and [the article 2 (Japanese)](https://qiita.com/mob-sakai/items/a24780d68a6133be338f).\n\n\n\n\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\n## Contributing\n\n### Issues\n\nIssues are very valuable to this project.\n\n- Ideas are a valuable source of contributions others can make\n- Problems show where this project is lacking\n- With a question you show where contributors can improve the user experience\n\n### Pull Requests\n\nPull requests are, a great way to get your ideas into this repository.  \nSee [CONTRIBUTING.md](/../../blob/develop/CONTRIBUTING.md).\n\n### Support\n\nThis is an open source project that I am developing in my spare time.  \nIf you like it, please support me.  \nWith your support, I can spend more time on development. :)\n\n[![](https://user-images.githubusercontent.com/12690315/50731629-3b18b480-11ad-11e9-8fad-4b13f27969c1.png)](https://www.patreon.com/join/mob_sakai?)  \n[![](https://user-images.githubusercontent.com/12690315/66942881-03686280-f085-11e9-9586-fc0b6011029f.png)](https://github.com/users/mob-sakai/sponsorship)\n\n\n\n\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\n## License\n\n* MIT\n\n\n\n## Author\n\n[mob-sakai](https://github.com/mob-sakai)\n[![](https://img.shields.io/twitter/follow/mob_sakai.svg?label=Follow\u0026style=social)](https://twitter.com/intent/follow?screen_name=mob_sakai) \n\n\n\n## See Also\n\n* GitHub page : https://github.com/mob-sakai/OpenSesameCompilerForUnity\n* Releases : https://github.com/mob-sakai/OpenSesameCompilerForUnity/releases\n* Issue tracker : https://github.com/mob-sakai/OpenSesameCompilerForUnity/issues\n* Change log : https://github.com/mob-sakai/OpenSesameCompilerForUnity/blob/upm/CHANGELOG.md\n* [No InternalsVisibleTo, no problem – bypassing C# visibility rules with Roslyn](https://www.strathweb.com/2018/10/no-internalvisibleto-no-problem-bypassing-c-visibility-rules-with-roslyn/)\n* Nuget version: https://www.nuget.org/packages/OpenSesameCompiler\n* asmdefScriptingDefines([@pCYSl5EDgo](https://github.com/pCYSl5EDgo)) : https://github.com/pCYSl5EDgo/asmdefScriptingDefines\n* Csc-Manager([@pCYSl5EDgo](https://github.com/pCYSl5EDgo)) : https://github.com/pCYSl5EDgo/Csc-Manager\n\n\n## Special Thanks\n\n* Special thanks to [@pCYSl5EDgo](https://github.com/pCYSl5EDgo), your ideas contributed to improve this package.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmob-sakai%2FOpenSesameCompilerForUnity","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmob-sakai%2FOpenSesameCompilerForUnity","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmob-sakai%2FOpenSesameCompilerForUnity/lists"}