How to create a secure package?

Hi…

I have created one package from some of my prefabs in my project. these prefabs have some C# codes in them and what i want is to encrypt these codes like no one can see the actual codes!!

I’ve seen some packages that use “.dll” files and in their code files they just use their own methods. i wanted to build a dll file from my code like what it said in this link

but i couldn’t get any dll file!

What should i do?!!

Creating a dynamic linked library requires you to first need something to turn into a .DLL file.
The main idea of a .DLL is that it is either imported or embedded at compile/runtime, after which scripts in your game reference code under it’s namespace.

For example, let’s say we have a math library in which it contains a class for a vector and some basic functions.

So you’d first make sure your project is set to build as a .DLL in visual studio, then go ahead and compile it (F7) to your builds folder.

Of course, it’s all up to speculation how you have it set up, but once it’s exported to this file, it’ll allow you to import it into unity (If it’s C#, or a version of C++ that allows you to import it.)

So now in our C# code we can call “using VectorNamespace;” then use everything from that file we made.

But then, I imagine that if you wanted to just drag and drop a .DLL onto a prefab, you might suffer some significant issues like it just not working. Perhaps look into a scripting language if you want to port at runtime, but I highly suggest just rolling without encryption until you need to release your application or game based on the sole fact you would need someone there to show you, or google-foo to help you step by step.

Summary:

  1. Create a new visual studio project, set it to ‘Class Library’ (.DLL export format)
  2. Create a class under your new namespace, give it all you would in a generic script. You can import unity by using some magic; google it.
  3. Build your solution using F7 or by going to Build/Solution in your toolbar.
  4. Locate the exported DLL if it succeeded to build.
  5. Import to unity under a new folder called Plugins under Assets (“Assets/Plugins/(your dll)”)
  6. Reference your code in the .DLL.