小高,上次因为代码打包到抖音手机预览问题,我追踪了代码,一个静态函数导致,启动不了,这个函数,在其他引擎打包到字节是正常的。
[code] public static deepCopy(instance: T): T {
if (instance == null) {
return instance
}
if (instance instanceof Date) {
return new Date(instance.getTime()) as any
}
if (instance instanceof Array) {
var cloneArr = [] as any[]
;(instance as any[]).forEach((value) => {
cloneArr.push(value)
})
return cloneArr.map((value: any) => GameUtils.deepCopy<any>(value)) as any
}
if (instance instanceof Object) {
var copyInstance = {...(instance as { [key: string]: any }),
} as { [key: string]: any }
for (var attr in instance) {
if ((instance as Object).hasOwnProperty(attr)) copyInstance[attr] = GameUtils.deepCopy<any>(instance[attr])
}
return copyInstance as T
}
return instance
}[/code]