UIMeshrenderer not working Cocos Creator 3.6

When I run my project on mobile and change the material of the 3D model in the script then it disappears from the UI.

In Cocos Creator 3.5.2 it work well. I’m using Cocos Creator 3.6.0

How did you change the material? What did the material change to?

updateModel(data: DataSkin) {

    let models = this.carModelContainer.getComponentsInChildren(MeshRenderer);

    // console.log(models, data.material);

    resources.load(data.material, Material, (err, res) => {

        if (!err) {

            for (let j = 0; j < models.length; j++) {

                var model = models[j];

                // model.node.getComponent(UIMeshRenderer).enabled = false;

                model.setMaterial(res, 0);

                // model.node.getComponent(UIMeshRenderer).enabled = true;

            }

        }

    });

}

Here is the code to change the material. And the same thing happens when you set enabled of UIMeshrenderer = false and set to true after.

When I hiding the 2d background everything well works. I think when I changed the material the 3d model layer was hidden under the 2d background.

I tried adding a 2d background, and it didn’t reproduce the problem.
57495.zip (7.3 KB)

image

Experiment with the material using effect: builtin-unlit and set the main texture for it

I did an example like yours test but it still doesn’t work. Can you help me find the problem? Thanks!
Test.zip (2.6 MB)

This problem I have created a new issue, the follow-up will be fixed in the issue, thanks for the feedback!

1 Like

This will be fixed in 3.7.
If you want to fix it in 3.6.x, in addition to merging pr, you have to modify these two files:

 \3.6.2\resources\resources\3d\engine\native\cocos\bindings\auto\jsb_2d_auto.cpp
 \3.6.2\resources\resources\3d\engine\native\cocos\bindings\auto\jsb_2d_auto.h

auto.zip (6.8 KB)