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

Fix the UI error issues caused by adjustments to the batching and splitting of UI elements. #18052

Merged
merged 3 commits into from
Dec 25, 2024

Conversation

GengineJS
Copy link
Contributor

No description provided.

@star-e
Copy link
Contributor

star-e commented Dec 18, 2024

Are all the !s need to be changed?

Copy link

⚠️ Package size ⤴ 255 bytes, old: 5442275, new: 5442530

Interface Check Report

This pull request does not change any public interfaces !

@GengineJS
Copy link
Contributor Author

Are all the !s need to be changed?

It seems unnecessary at the moment; the impact of resetState is not significant, and testing has shown no issues.

@star-e
Copy link
Contributor

star-e commented Dec 18, 2024

Shall we only change the ! causing the problem? Although ! is error prone, I think it's better than checking nullity everywhere.
@GengineJS @dumganhar

@dumganhar
Copy link
Contributor

dumganhar commented Dec 18, 2024

I think we need to check whether renderData is null in all places since we modified the behavior in UIRenderer which is a base class.

@star-e
Copy link
Contributor

star-e commented Dec 18, 2024

I think we need to check whether renderData is null in all places since we modified the behavior in UIRenderer which is a base cass.

I see. So we should change all the renderData.

@dumganhar
Copy link
Contributor

@cocos-robot run test cases

Copy link

@GengineJS, Please check the result of run test cases:

Task Details

Copy link

@GengineJS, Please check the result of run test cases:

Task Details

Platform build boot runned crashScene FailScene
windows PASS PASS PASS
android PASS PASS PASS
wechatgame PASS PASS FAIL BuildTimeConstantsTest

@dumganhar dumganhar merged commit 08b5221 into cocos:v3.8.6 Dec 25, 2024
13 checks passed
@@ -320,6 +320,10 @@ export class UIRenderer extends Renderer {
this.node.on(NodeEventType.ANCHOR_CHANGED, this._nodeStateChange, this);
this.node.on(NodeEventType.SIZE_CHANGED, this._nodeStateChange, this);
this.node.on(NodeEventType.PARENT_CHANGED, this._colorDirty, this);
// If the renderData is invalid, it needs to be rebuilt to recalculate the batch processing.
if (!this._renderData && this._flushAssembler) {
this._flushAssembler();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will cause the issue: https://forum.cocos.org/t/topic/165212/66
In ParticleSystem2D component, this._renderData is always null, so each time onEnable is invoked, ParticleSystem2D._flushAssembler method will be invoked which will create new RenderData in it.

    protected _flushAssembler (): void {
        const assembler = ParticleSystem2D.Assembler.getAssembler(this);

        if (this._assembler !== assembler) {
            this._assembler = assembler;
        }
        if (this._assembler && this._assembler.createData) {
// ---> this._simulator.renderData will be overridden.
            this._simulator.renderData = this._assembler.createData(this);
            this._simulator.renderData.particleInitRenderDrawInfo(this.renderEntity); 
            this._simulator.initDrawInfo();
        }
    }

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

Successfully merging this pull request may close these issues.

4 participants