unity的离线手册是静态的html,因为某些原因打开的时候会很慢很慢
最直接的解决方法是断网,当然了,断网使用体验太差了,
也可以通过改环境的方法解决,例如小飞机或者改host等等,
如果不想改环境,可以把所有html文件里的关键文本改掉,
下面代码通过Python代码删掉html中的:
cdn.cookielaw.org/scripttemplates/otSDKStub.js
www.googletagmanager.com
fonts.googleapis.com
代码
#!/usr/bin/env python3
import os
fileNum = 0
for (dirpath, dirs, files) in os.walk(os.path.curdir):
for file in files:
if file.endswith(".html"):
filePath = os.path.join(dirpath,file)
with open(filePath,'r',encoding='utf-8') as f:
s = f.read().replace("cdn.cookielaw.org/scripttemplates/otSDKStub.js",'').replace("www.googletagmanager.com",'').replace("fonts.googleapis.com",'')
with open(filePath,'w',encoding='utf-8') as f:
f.write(s)
fileNum = fileNum + 1
message = ">>>修改完成 进度:" + f'{round(fileNum / 25414 * 100, 2)}' + "% 文件: " + filePath
print(message)
print("共修改",fileNum,"个文件")
注意
注意在文档路径里运行
手册下载
Uinty离线手册(2020.3)的官方下载链接:
英文版:https://storage.googleapis.com/docscloudstorage/2020.3/UnityDocumentation.zip
中文版:https://storage.googleapis.com/localized_docs/zh-cn/2020.3/UnityDocumentation.zip