头图

1)Unity引擎关于APP后台下载支持的实现问题
2)Prefab对DLL中脚本的引用丢失
3)Unity DOTS资源加载问题
4)UnitySendMessage和_MultiplyMatrixArrayWithBase4x4_NEON调用导致崩溃


这是第376篇UWA技术知识分享的推送,精选了UWA社区的热门话题,涵盖了UWA问答、社区帖子等技术知识点,助力大家更全面地掌握和学习。

UWA社区主页:community.uwa4d.com
UWA QQ群:465082844

Network

Q:最近很多游戏在Loading界面会标明支持后台下载模式,项目也计划实现一个,首先找到了Unity自带的BackgroundDownload解决方案,功能是可以的,也好接入,但项目中的文件数量比较多,有大几万个,同时建立这么多链接非常卡顿,经过简易优化,速度提升了一些,同时平滑建立连接数不再那么卡顿,但所有连接建立完还是需要很长时间,同时Android环境在创建1000+个下载服务时,会崩溃,没有明确的报错,每次会有下图中的异常!

咨询下各位大佬,如下几个问题:
1. 崩溃如何处理?
2. 如何平滑快速地建立起下载连接?
3. 有没有其他更好的处理类似问题的解决方案?

A:可以试试以下方案:

方案1:把所有要下载的任务,放到1个队列,开多个线程去处理这个队列的下载任务,并且限制设定同时下载的任务数。

方案2:把对应资源,根据一些规则(如:等级1-10级会用到的资源在1个zip包,11-20级会用到的资源放在1个zip包),然后根据一些条件在不同时刻来下载不同的zip包。

感谢hejianchun@UWA问答社区提供了回答

Prefab

Q:开发时,不希望策划看到源码,于是将源码替换成DLL,但是这样挂在Prefab上的脚本引用会丢失,请问怎么解决?

A:可以试试以下方案:
方案1:程序项目内也使用DLL的方式。
方案2:Component动态Add上去。

感谢hejianchun@UWA问答社区提供了回答

DOTS

Q:我用Unity ECS 1.0,如果场景里有子Scene,那么子Scene是否勾选的区别是什么?我知道,如果不勾选Bake函数在Editor模式就会开始执行,但如果里面有Resource加载这样的运行时接口就会报错,请问怎么解决?

针对以上问题,有经验的朋友欢迎转至社区交流分享:
https://answer.uwa4d.com/question/65def28c40a8d93b624afcf0


Crash

Q:安卓平台崩溃问题,发现调用方法是UnitySendMessage和_MultiplyMatrixArrayWithBase4x4_NEON,各位有遇到过的吗?

Unity版本:2021.3.11f1c2;
libunity.0xe20870-libunity.0xe106b8是UnitySendMessage;
libunity.0x4457cc-libunity.0x50965c是_MultiplyMatrixArrayWithBase4x4_NEON。

信息如下:

Caused by: java.lang.Error: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
Version '2021.3.11f1c2 (2c7757f00bfe)', Build type 'Release', Scripting Backend 'il2cpp', CPU 'arm64-v8a'
Build fingerprint: 'samsung/e3qxeea/e3q:14/UP1A.231005.007/S928BXXU1AWM9:user/release-keys'
Revision: '13'
ABI: 'arm64'
Timestamp: 2024-02-20 16:59:33+0800
pid: 30649, tid: 31379, name: Job.Worker 1  
uid: 10421
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x76ebcb5000
    x0  0000000000000000  x1  000000000000010e  x2  00000000000000ff  x3  0000000000ff0000
    x4  0000000000a20000  x5  0000000000000010  x6  00000076409907b8  x7  000000000f800000
    x8  00000075701da080  x9  00000076ebcb5004  x10 00000075701da08c  x11 0000000000000030
    x12 00000075701da098  x13 0000000000000030  x14 0000000000000000  x15 0000000000000000
    x16 0000000000000000  x17 00000076409905d4  x18 0000000000000000  x19 0000007640990970
    x20 00000075e01f3290  x21 00000076ebcb4ffc  x22 0000007640990601  x23 0000000038800000
    x24 00000000b8800000  x25 0000000000000030  x26 00000075701d6e08  x27 00000076ebcb4ffc
    x28 0000007640990550  x29 0000000000000000
    sp  0000007640990480  lr  0000000038000000  pc  000000766ae96870

backtrace:
      #00 pc 0000000000e20870  /data/app/~~iu98SuuYphKnX60ZotTOng==/-vNyiDhpbcBIkm6XnXDDGxg==/lib/arm64/libunity.so (BuildId: ae67f16cb275ae637576fa8522cf80f73e009dd8)
      #01 pc 0000000000e1550c  /data/app/~~iu98SuuYphKnX60ZotTOng==/-vNyiDhpbcBIkm6XnXDDGxg==/lib/arm64/libunity.so (BuildId: ae67f16cb275ae637576fa8522cf80f73e009dd8)
      #02 pc 0000000000e10ac4  /data/app/~~iu98SuuYphKnX60ZotTOng==/-vNyiDhpbcBIkm6XnXDDGxg==/lib/arm64/libunity.so (BuildId: ae67f16cb275ae637576fa8522cf80f73e009dd8)
      #03 pc 0000000000e106b8  /data/app/~~iu98SuuYphKnX60ZotTOng==/-vNyiDhpbcBIkm6XnXDDGxg==/lib/arm64/libunity.so (BuildId: ae67f16cb275ae637576fa8522cf80f73e009dd8)
      #04 pc 00000000004457cc  /data/app/~~iu98SuuYphKnX60ZotTOng==/-vNyiDhpbcBIkm6XnXDDGxg==/lib/arm64/libunity.so (BuildId: ae67f16cb275ae637576fa8522cf80f73e009dd8)
      #05 pc 0000000000445acc  /data/app/~~iu98SuuYphKnX60ZotTOng==/-vNyiDhpbcBIkm6XnXDDGxg==/lib/arm64/libunity.so (BuildId: ae67f16cb275ae637576fa8522cf80f73e009dd8)
      #06 pc 0000000000445c98  /data/app/~~iu98SuuYphKnX60ZotTOng==/-vNyiDhpbcBIkm6XnXDDGxg==/lib/arm64/libunity.so (BuildId: ae67f16cb275ae637576fa8522cf80f73e009dd8)
      #07 pc 00000000004451b4  /data/app/~~iu98SuuYphKnX60ZotTOng==/-vNyiDhpbcBIkm6XnXDDGxg==/lib/arm64/libunity.so (BuildId: ae67f16cb275ae637576fa8522cf80f73e009dd8)
      #08 pc 000000000050965c  /data/app/~~iu98SuuYphKnX60ZotTOng==/-vNyiDhpbcBIkm6XnXDDGxg==/lib/arm64/libunity.so (BuildId: ae67f16cb275ae637576fa8522cf80f73e009dd8)
      #09 pc 00000000000c37b4  /apex/com.android.runtime/lib64/bionic/libc.so (__pthread_start(void*)+208) (BuildId: 37f537c2ba9dcbb262a0a68f41a21da4)
      #10 pc 000000000005d084  /apex/com.android.runtime/lib64/bionic/libc.so (__start_thread+68) (BuildId: 37f537c2ba9dcbb262a0a68f41a21da4)

at libunity.0xe20870(Native Method)
at libunity.0xe1550c(Native Method)
at libunity.0xe10ac4(Native Method)
at libunity.0xe106b8(Native Method)
at libunity.0x4457cc(Native Method)
at libunity.0x445acc(Native Method)
at libunity.0x445c98(Native Method)
at libunity.0x4451b4(Native Method)
at libunity.0x50965c(Native Method)
at libc.__pthread_start(void*)(__pthread_start:208)
at libc.__start_thread(__start_thread:68)

针对以上问题,有经验的朋友欢迎转至社区交流分享:
https://answer.uwa4d.com/question/65d5a39240a8d93b624afce7

封面图来源于网络


今天的分享就到这里。生有涯而知无涯,在漫漫的开发周期中,我们遇到的问题只是冰山一角,UWA社区愿伴你同行,一起探索分享。欢迎更多的开发者加入UWA社区。

UWA官网:www.uwa4d.com
UWA社区:community.uwa4d.com
UWA学堂:edu.uwa4d.com
官方技术QQ群:465082844


侑虎科技
62 声望21 粉丝

UWA官网:[链接]