1
\$\begingroup\$

I want to create an asset/bundle that I can drop into projects to get up and running easily. Ideally this bundle would be closed-source so that the code is not accessible, but yet still usable. Is there a way to do this with Unity, or does the way packages work simply mean bundles will always be accessible/browsable for the source code?

I am planning on doing this for a simple 1st person controller, so that I can easily drop it into demo scenes of assets I purchase, to get a quick feel for using them. If possible, I would also distribute this as an asset (likely free, maybe minimal cost). Is there anyway to keep it closed-source, or is this simply not possible?

\$\endgroup\$
2
  • 1
    \$\begingroup\$ 1st person controllers are a dime a dozen. Is there anything special about yours that has never been seen on the Internet before? If not (and particularly if you're considering distributing it for free), is there really any value in obfuscating the source code? You might be able to redirect effort you would sink into solving this (not perfectly solvable) problem into something that gives you much more benefit instead. \$\endgroup\$
    – DMGregory
    Jul 15 at 1:08
  • \$\begingroup\$ @DMGregory Excellent point, and I have only partially considered it. I have not yet found a 1st person controller that is literally drag-and-drop; those I have seen require some configuration, however tiny. I am going for something that I can literally just drag and drop into a scene, with no configuration necessary. You touched on a good point; this would likely not be for free (and therefore may be pointless). The fastest approach may wind up being a normal plugin; just thought I'd explore this path as well. Thanks! \$\endgroup\$
    – Kendall
    Jul 15 at 2:48
1
\$\begingroup\$

You can compile your code into a managed plugin (DLL). However, be aware that DLLs can be decompiled by third-party tools back into source code. It's not something I've tried myself, but IIRC I've heard that the decompiled code is very similar to the original source and thus very easy to read, unless you obfuscate it.

\$\endgroup\$
1
  • \$\begingroup\$ Thank you for this pointer; I'm not sure how I missed that in the docs (apparently wasn't in that section)! This is definitely what I was looking for; at least, I believe so. I don't think this necessarily supports "dragging" in a prefab (appears to just be scripts), but it definitely hits the closed source criteria. I am also aware, as you mentioned, of decompilation (not too worried about this). Thanks! \$\endgroup\$
    – Kendall
    Jul 15 at 2:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.