真机运行,报如下错
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))