unity代码加密

    之前使用unity引擎写代码都是直接在Unity里面Create一个C#脚本,然后直接用Unity自带的Mono或者VS打开脚本就行了。
                                                公司的项目都是封装成dll的形式,为了有好的加密性,然后自己也动手操作了一下,顺便写一个教程。


首先:安装一个Visual Studio,然后创建一个Library,如图:
 
图片貌似有点模糊,就是新建一个C#的Class Libary。

然后创建好之后,我们在这个Class Library下面创建一个C#脚本,因为此时还没有references  Unity的库,所以Unity的一些引用会报错,我们还需要一步操作,就是把Unity的库添加到这个Class Library下面。
 

添加一个引用,我们需要找到你Unity的安装目录F:\unity5.0\Unity\Editor\Data\Managed,然后Browse到这个目录下,把Unity封装的dll文件关联到引用就可以了。

最后一步,我们设置编译事件,将编译后的dll和pdb拷贝到你的Unity工程里面。
 
Post-build event command line:是设置编译后的事件,我们设置编译后将dll和pdb拷贝到游戏工程里。

copy "$(TargetDir)$(TargetName).dll" F:\Project\byme\Assets\Script\$(TargetName).dll
copy "$(TargetDir)$(TargetName).pdb" F:\Project\byme\Assets\Script\$(TargetName).pdb

这里中间的路径我们可以使用绝对路径,也可以使相对路径,编译完成之后,我们就可以直接在Unity工程里使用这些dll。具体的使用跟Unity里面的脚步一样,拖到你需要添加的物体上就可以。
淘宝花钱买的最新版!需要的拿去! This asset obfuscates your code to make it harder for bad guys to reverse engineer your projects. Specifically designed for Unity, it seamlessly links in with its build process. The top priority of this package is to work straight out of the box with no extra steps required. While other obfuscators can stop a game from working, Beebyte's obfuscator looks for specific Unity related code that must be protected. The contents of your source files are unchanged, the obfuscation targets the compiled assembly. Features: - Supports IL2CPP - Supports Assembly Definition Files (Unity 2017.3+) - Removes Namespaces without any conflicts - Recognises Unity related code that must not be changed - Renames Classes (including MonoBehaviours) - Renames Methods - Renames Parameters - Renames Fields - Renames Properties - Renames Events - String literal obfuscation - Adds fake methods - Easy and extensive customisation using the Unity inspector window - Consistent name translations are possible across multiple builds and developers - Semantically secure cryptographic naming convention for renamed members The asset works for both Unity Free and Unity Pro version 4.2.0 onwards (including Unity 5 & 2017 & 2018). Build targets include Standalone, Android, iOS, WebGL, UWP. Other platforms are not guaranteed or supported but may become supported at a future date. IL2CPP builds are much harder to reverse engineer but strings and member information (class, method names etc) are visible in the global-metadata.dat file. Obfuscation will apply to this file adding further security. Why not complement your security with the Anti-Cheat Toolkit - a great third party asset. For more information about the Obfuscator, please see the FAQ
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值