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!"
MIT License
⚠️ NOTE: This project has been integrated into CSharpCompilerSettingsForUnity. We are NOT continuing development in this repository. ⚠️
A custom Roslyn compiler and editor extension 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!"
<< Description | Installation | Usage | Contributing >>
Then Ali Baba climbed down and went to the door concealed among the bushes, and said, "Open, Sesame!" and it flew open.
This package allows to access to any internals/privates in other assemblies, without reflection.
For details about IgnoresAccessChecksToAttribute
, see
No InternalsVisibleTo, no problem – bypassing C# visibility rules with Roslyn.
AssemblyDefinitionFile
you configuredAssemblyDefinitionFiles
.Net 3.5
, .Net 4.x
and .Net Standard 2.0
dotnet
is not requiredcsc-manager enable-vscode
: Show internals/privates in other assembly.csc-manager disable-vscode
: Hide them.This package is available on OpenUPM. You can install it via openupm-cli.
openupm add com.coffee.open-sesame-compiler
Find the manifest.json
file in the Packages
directory in your project and edit it to look like this:
{
"dependencies": {
"com.coffee.open-sesame-compiler": "https://github.com/mob-sakai/OpenSesameCompilerForUnity.git",
...
},
}
To update the package, change suffix #{version}
to the target version.
"com.coffee.open-sesame-compiler": "https://github.com/mob-sakai/OpenSesameCompilerForUnity.git#1.0.0",
Or, use UpmGitExtension to install and update the package.
AssemblyDefinitionFile
in project viewOpen Sesame Compiler
package installed.git clone -b demo https://github.com/mob-sakai/OpenSesameCompilerForUnity.git
// EditorApplication.CallDelayed is an internal-static method in UnityEditor assembly.
EditorApplication.CallDelayed(() => Debug.Log("delayed"), 1);
Assets/Tests/Coffee.OpenSesame.Test.asmdef
in project view and activate 'Open Sesame' in inspector viewWindows > General > Test Runner
).[Test]
public void DefineSymbols()
{
const string log = "OSC_TEST is defined.";
LogAssert.Expect(LogType.Log, log);
#if OSC_TEST // <- not defined!
Debug.Log(log);
#endif
}
[Test]
public void RemoveSymbols()
{
const string log = "TRACE is not defined.";
LogAssert.Expect(LogType.Log, log);
#if !TRACE // <- defined automatically by Unity!
Debug.Log(log);
#endif
}
symbols
to modify scripting define symbols for this assembly.Modify Symbols
to OSC_TEST;!TRACE
. This means "add OSC_TEST
symbol and remove TRACE
symbol for this assembly."For more details, see the article 1 (Japanese) and the article 2 (Japanese).
Issues are very valuable to this project.
Pull requests are, a great way to get your ideas into this repository. See CONTRIBUTING.md.
This is an open source project that I am developing in my spare time. If you like it, please support me. With your support, I can spend more time on development. :)