Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

使用位图字体,Creator3.8.3 Android 构建开启DEBUG后,运行报错 #90

Open
SQTimTao opened this issue Jun 18, 2024 · 2 comments

Comments

@SQTimTao
Copy link

SQTimTao commented Jun 18, 2024

使用自带的demo工程,用3.8.3版本构建android,并在构建面板中开启debug,运行后点击圆形进度就会报错,
报错位置

        if (JSB && this.multiOwner === false) {
            if (DEBUG) {
                assert(this._renderDrawInfo.render2dBuffer.length === this._floatStride * this._data.length, 'Vertex count doesn\'t match.');
            }
            // sync shared buffer to native
            this._renderDrawInfo.fillRender2dBuffer(this._data);
        }

错误堆栈:

(see stack) Uncaught TypeError: Cannot read properties of undefined (reading 'length')  - [0]updateRenderData@src/cocos-js/cc.js:39374:58
 - [1]updateRenderData@src/cocos-js/cc.js:48479:24
 - [2]_applyFontTexture@src/cocos-js/cc.js:41139:33
 - [3]updateRenderData@src/cocos-js/cc.js:41073:18
 - [4]set font@src/cocos-js/cc.js:40832:16
 - [5]assignFont@src/chunks/bundle.js:5508:49
 - [6]updateFont@src/chunks/bundle.js:5523:16
 - [7]set font@src/chunks/bundle.js:5299:18

看起来是 render2dBuffer 为 undefined

在web环境下则没有问题

@SQTimTao SQTimTao changed the title 使用位图字体,Creator3.8.3 Android 构建开启DEBUG后,进入断言 使用位图字体,Creator3.8.3 Android 构建开启DEBUG后,运行报错 Jun 18, 2024
@xiaoguzhu
Copy link
Member

这个要到引擎那边找答案

@hssing
Copy link

hssing commented Sep 6, 2024

我查过,在设置位图字体的时候,creator会去更新渲染数据,然而首次设置时,由于 FUI的文本数据是在 设置字体之后,导致 creator在计算时,文本内容长度为0,没有初始化到,所以render2dBuffer 为 undefined,我尝试过,可以在引擎测修改,进行初始化,也可以在FUI测提前设置文本

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants