[bug?][CocosCreator]Child node of "cc.Mask" is not drawn correctly in Cocos Creator

I use CocosCreator v2.1.0.
I tried displaying dynamically loaded spine resources.
I confirmed that it is displayed correctly with the following code.

        // load temporary resource & set
        const completeCallback = (error: Error, resource: any) => {
            this.skeleton.skeletonData = resource;
            this.skeleton.animation = 'test_animation_name';
        };
        cc.loader.loadRes('dynamic_resource_url/skeleton', sp.SkeletonData, completeCallback);

However, if you execute in the following order, the display will be weird.

  1. Load sp.SkeletonData dynamically.
  2. Set sp.SkeletonData to sp.Skeleton.
    (“sp.Skeleton” is a child node of “cc.Mask”.)
  3. Destroy a dynamically loaded resource once.
        const deps = cc.loader.getDependsRecursively(resource);
        deps.forEach(url => {
            cc.loader.release(url);
        });
  1. Load sp.SkeletonData again and set it to sp.Skeleton.
  2. Skeleton will not be displayed correctly.
  3. However, if “cc.Mask” is disabled, it will be displayed correctly.

I want to ask some questions.

  • Is the code for dynamically loading resources correct?
  • Is the code for dynamically releasing resources correct?
  • Are there any restrictions when using masks?

Best regards.

sample_project.zip (721.7 KB)

Hello.
How about releasing with cc.loader.releaseRes?

Hello!

Thank you for your reply.
I tried cc.loader.releaseRes.

cc.loader.releaseRes ('dynamic_resource_url/skeleton');

The skeleton was displayed correctly regardless of cc.Mask!
However, even if you check the memory size in Chrome’s task manager, executing releaseRes does not change the GPU memory size.

It has been confirmed that the memory size decreases when the following code is executed.

const deps = cc.loader.getDependsRecursively (tempResource);
deps.forEach (url => {
  cc.loader.release (url);
});

Is memory not immediately released when using cc.loader.releaseRes?
My goal is to ensure that dynamic resource allocation and release is done correctly.
Please let me know if there is a problem with the usage of cc.loader.

I have no right answer to that question.
However, I discovered that if the skeleton is not recycled, the problem does not occur.

Here’s how to release the related resources mentioned in the document:

var deps = cc.loader.getDependsRecursively('prefabs/sample');
cc.loader.release(deps);

Perhaps you are not wrong.

Thank you for your reply.

If the code is not a problem, it may be a bug in the cocos creator engine.

This phenomenon only occurs when cc.Mask is used …
Somehow I think that is because cc.Mask has a reference to the released texture.

I hope that we can update the status of cc.Mask in some way.