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

Unity3D 专栏收录该内容
440 篇文章 89 订阅

真机运行,报如下错

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))
  • 0
    点赞
  • 0
    评论
  • 2
    收藏
  • 一键三连
    一键三连
  • 扫一扫,分享海报

相关推荐
©️2020 CSDN 皮肤主题: Age of Ai 设计师:meimeiellie 返回首页
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值