- Home /
How to "hide" C# code from custom package for distribution?
I am developing a custom package. It contains native plugin, c# scriptable objects, c# scripts, custom editors and sample scenes and assets that use all the above.
I would prefer not to include any of my C# code in the version of the package i distribute. Is it possible to include the corresponding "compiled C#" instead? I believe these are called assemblies (I am not too familiar with these terms yet). I recall having read that this was possible somewhere but can no longer find the info . Any pointer or term I should search for would help.
Answer by JDelekto · Mar 15, 2020 at 07:50 AM
Building an assembly in C# can be done by building a .NET DLL. You could do this through a Visual Studio Class Library. You need to reference any dependencies (including the appropriate .NET Framework DLLs) as well as the Unity libraries for your platform.
Unity calls these Managed Plug-ins and provides some documentation on them. While you can create your own DLLs, they can be typically de-compiled back into source code; while not necessarily a true representation of what went into it, can still be read and understood by people reverse-engineering it.
You could go one step further and obfuscate the code, there are some tools on the Unity Asset Store which are capable of doing this for you.
Your answer
Follow this Question
Related Questions
Shared runtime for multiple projects 0 Answers
Distribution of instances 0 Answers
Import package error (ARToolKit) 6 Answers
2018.2 Where is Window > Package Manager? 2 Answers
Custom Package Editor Script 2 Answers