编译Windows平台unity mono库方法总结

首先感谢文章https://blog.csdn.net/swj524152416/article/details/69946259https://blog.csdn.net/Teddy_k/article/details/83502286的作者,本文主要参考这两篇文章。

1. GitHub上下载需要版本的mono源码:mono下载链接:https://github.com/Unity-Technologies/mono

经过测试最好使用VS2010编译,直接就能成功。

2.下载加密解密算法

c版xxtea算法:https://github.com/xxtea/xxtea-c

.net版xxtea算法:https://github.com/xxtea/xxtea-dotnet

    在下载好xxtea后,复制xxtea.c和xxtea.h两个文件到开始下载的mono的源码里,具体位置在mono/mono/metadata文件夹下。

然后再用vs2010打开mono/msvc/mono.sln,将上面的xxtea的两个文件添加到libmono里,并找到libmono下的image.c,添加xxtea的头文件。

3. 在该类下找到mono_image_open_from_data_with_name方法,添加解密代码,然后设置设置libmono为启动项,配置选Release_glib,32位62位各打一个,生成文件在根目录/Mono/EmbedRuntime 下。

本人试验VS2010下直接重新生成解决方案就能通过。

4.Unity下编写加密和打包功能代码,参考 https://blog.csdn.net/swj524152416/article/details/69946259 这篇文章

5.将上面生成的mono.dll文件改为后缀.txt文件放到Unity中打包即可,注意这个方式只适用于.net3.5平台。.net 4x下打出的包不存在mono.dll,而是另外一个MonoBleedingEdge/mono-2.0-bdwgc.dll文件。

发布了20 篇原创文章 · 获赞 0 · 访问量 1万+

猜你喜欢

转载自blog.csdn.net/gcj2450/article/details/103188484