cocos / cocos-engine

Cocos simplifies game creation and distribution with Cocos Creator, a free, open-source, cross-platform game engine. Empowering millions of developers to create high-performance, engaging 2D/3D games and instant web entertainment.
https://www.cocos.com/en/creator
Other
8.83k stars 2.05k forks source link

android 端 createMesh crash #17907

Open zanqwq opened 4 days ago

zanqwq commented 4 days ago

Cocos Creator version

3.8.4

System information

android xiaomi tablet

Issue description

封装判空的 createMesh 方法传入两个可选参数导致 android 端崩溃

Relevant error log output

No response

Steps to reproduce

新建节点绑定以下脚本即可

import { _decorator, Component, Mesh, MeshRenderer, Node, utils } from 'cc';
const { ccclass, property } = _decorator;

@ccclass('test')
export class test extends Component {
    start() {
        const createMesh: typeof utils.MeshUtils.createMesh = (geo, out, opt) => {
            console.log('@@@', geo, out, opt);
            if (geo.positions.length > 0) {
                return utils.MeshUtils.createMesh(geo, out, opt);
            }
            return new Mesh();
        }

        this.getComponent(MeshRenderer).mesh = createMesh({ positions: [0, 0, 0, 1, 0, 0, 0, 1, 0] });
    }

    update(deltaTime: number) {

    }
}

Minimal reproduction project

No response

longchuan commented 3 days ago

web端没提示warn或error吗

zanqwq commented 1 day ago

web端没提示warn或error吗

没有嘞好像 @longchuan

longchuan commented 13 hours ago

web端没提示warn或error吗

没有嘞好像 @longchuan

为什么是好像,createMesh函数并没有赋值out, opt,这个不会报错吗