[Bug] [Node] [Sprite] [WebMobile] - issue with enable/disable sprite node

[Bug] [Node] [Sprite] [WebMobile] - issue with enable/disable sprite node

Hello everyone. I make some project on Cocos Creator v2.2.2 and i have unpleasant situation a few days ago. My game has a few scenes and sometimes when i load second scene browser page begin spam exceptions into developer console. The last exceptions thrown point at render-flow.js:75 script.
On line 75 is a function that call callbacks render method of various renderer components, as I understand it. And the main problem in this case is that the callback may turn out to be a random rendering function. You will think that the problem is in the spine component or the sprite component, because no other exceptions are thrown. But is not.
I began disable and removing assets and code and got a small example (before tested other options a couple of days).
The essence of the method is as follows:

  1. Create two scripts.
  2. Attach scripts on nodes (difference in my case)
  3. In 1 script at onLoad method call node.active = false
  4. In 2 script at start method we call new method from script 1 with sprite.enabled = false & node.active = true body.

This result is guaranteed to start throwing exceptions to the console until the sprite component is turned back on. In my app its issue happened by accident when i set identical Sprite Frame in sprite component that was set in node prefab in scene. If method from 4 move into start method of script 1, all be alright.

Maybe this situation not a bug, but it’s unobvious thing that took a long time to solve. And you need to find the right combination of calls to make it work.

I attach the project archive for the possibility of repetition.


assets.zip (3.0 KB)

can you please attach the whole project please? i get a bunch of missing script errors just pasting those assets into a new project.

Hi, CocosCreatorProj.zip (228.4 KB)

it’s not a code issue :slight_smile:

i would suggest to remove the “1” node, drag and drop the “White_Quad” from the assets as a child of “New Node”, run and check that it works :wink:

also, in Breaker.ts, change the frame type to “cc.Sprite”