Unity真机运行报Could not allocate memory / Memory overview / Position out of bounds

真机运行,报如下错

08-20 15:02:02 curframe:166 Could not allocate memory: System out of memory!
Trying to allocate: 892416011B with 16 alignment. MemoryLabel: TempOverflow
Allocation happend at: Line:178 in 
Memory overview

[ ALLOC_DEFAULT ] used: 17440343B | peak: 32416404B | reserved: 18238514B 
[ ALLOC_TEMP_JOB ] used: 0B | peak: 0B | reserved: 786432B 
[ ALLOC_GAMEOBJECT ] used: 6215379B | peak: 6389625B | reserved: 6296338B 
[ ALLOC_GFX ] used: 588236B | peak: 4426136B | reserved: 591143B 
[ ALLOC_PROFILER ] used: 0B | peak: 0B | reserved: 0B 
[ ALLOC_TEMP_THREAD ] used: 32772B | peak: 0B | reserved: 2981888B 
The file 'archive:/CAB-076dfbe6b3fdfcc5f6d960b887dbc5fd/CAB-076dfbe6b3fdfcc5f6d960b887dbc5fd' is corrupted! Remove it and launch unity again!
[Position out of bounds!]

原因是我们项目今天有个美术上传了本地修改的meta文件,应该是导致了两个资源的GUID冲突了,最后读文件的时候读取到其他的文件去了,解决方案是全部重新Import一次,或者把Library目录删掉 重新打开Unity,或者还原这几个Meta文件

为了方便检查GUID是否有冲突,写了个python脚本
把下面的脚本放到Assets目录中,运行即可

# check_guid_repeat.py
import os
import re

def get_meta_files():
    for root,dirs,fs in os.walk('./'):
        for f in fs:
            if f.endswith('.meta'):
                yield root+'/' +f

def get_guid(f, t):
    if not os.path.exists(f):
        print(f + ' not exists')
        return
    fr = open(f, 'r')
    txt = fr.read()
    match = re.search('guid: (.*)', txt)
    guid = match.group(1)
    if guid in t:
        print('文件: '+ t[guid] + '\n和\n ' + f +'\nguid冲突了\nguid: ' + guid)
    else:
        t[guid] = f
    

if '__main__' == __name__:
	curDir = os.getcwd()
    t = {}
    f_cnt = 0
    for f in get_meta_files():
        get_guid(curDir + '/' +f, t)
        f_cnt = f_cnt +1
    print('check done, f_cnt: ' + str(f_cnt))
  • 4
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

林新发

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值