Skip to content

mob-sakai/InternalAccessibleCompilerForUnity

Repository files navigation

Internal Accessible Compiler

⚠️ NOTE: This project has been integrated into CSharpCompilerSettingsForUnity. We are NOT continuing development in this repository. ⚠️





This package generates an 'internal accessible' dll.

In other words, you can internally access to other assemblies without reflection.

PRs Welcome

<< Description | Install | Usage >>

What's new? See changelog

Do you want to receive notifications for new releases? Watch this repo

Support me on GitHub!

become_a_sponsor_on_github





Description

About IgnoresAccessChecksToAttribute
No InternalsVisibleTo, no problem – bypassing C# visibility rules with Roslyn





Install

Find Packages/manifest.json in your project and edit it to look like this:

{
  "dependencies": {
    "com.coffee.internal-accessible-compiler": "https://github.com/mob-sakai/InternalAccessibleCompilerForUnity.git",
    ...
  },
}

To update the package, add/change prefix #version to the target version.
Or, use UpmGitExtension.

Requirement

  • Unity 2018.3 or later
  • Dot Net 2.1 or later





Usage

Compile AssemblyDefinitionFile to an 'internal accessible' dll

  1. Select *.asmdef in project view.
  2. Click Right button and select Internal Accessible Compiler > Setting in context menu.
  3. Open Internal Accessible Compiler Setting and configure compile setting.
    • Assembly Names To Access: Target assembly names separated by semicolons to access internally (eg. UnityEditor;UnityEditor.UI)
    • OutputDllPath: Output dll path (eg. Assets/Editor/SomeAssembly.dll)
  4. Press Compile button to start compiling. After compilation, the dll will be automatically imported.
  5. Enjoy!





Demo

A demo project that dynamically changes the text displayed in UnityEditor's title bar. (This package is used in Solution 3.) https://github.com/mob-sakai/MainWindowTitleModifierForUnity

In this class, ApplicationTitleDescriptor, EditorApplication.updateMainWindowTitle and EditorApplication.UpdateMainWindowTitle are internal elements. However, the class accesses to them without reflection.

For more details, see this article (Japanese)





License

  • MIT

Author

mob-sakai
become_a_sponsor_on_github

See Also