IH121 Posted February 15, 2020 Share Posted February 15, 2020 the line: if(user_cubes[i][0]!==undefined){ console.log("remove_cubes -> user_cubes[i][0] !== undefined"); console.log(user_cubes[i][0]); app.stage.removeChild(user_cubes[i][0]); } prints: remove_cubes -> user_cubes[0] !== undefined and the next object: e {_events: n, _eventsCount: 0, tempDisplayObjectParent: null, transform: e, alpha: 1, …} which is seems tobe a pixi object, and when written in console the object is deleted. i don't expect to get a solution, considering this is just a sample from the long code, but if one of you has an idea what the problem can be it could help a lot. Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted February 15, 2020 Share Posted February 15, 2020 (edited) Hello, and Welcome to the forums! My answer will be very short: what do you expect here? that console shows null? That object will be empty? "removeChild" just removes this particular container from another container childs list, and maybe modifies a few variables related to that. If you want clear object fields, call destroy() on it, it will also call removeChild. If you want to get rid of object from javascript memory, well, you have to read have JS GC works, that's a bigger topic. Edited February 15, 2020 by ivan.popelyshev Quote Link to comment Share on other sites More sharing options...
IH121 Posted February 15, 2020 Author Share Posted February 15, 2020 (edited) 5 minutes ago, ivan.popelyshev said: Hello, and Welcome to the forums! My answer will be very short: what do you expect here? that console shows null? That object will be empty? "removeChild" just removes this particular container from another container childs list, and maybe modifies a few variables related to that. If you want clear object fields, call destroy() on it, it will also call removeChild. If you want to get rid of object from javascript memory, well, you have to read have JS GC works, that's a bigger topic. I expected the visual propety to be deleted, removed from the stage. the cube object exist on the board and when I normally use this command it works fine. later in the code I discard the object and I let the garbage collector "do it's thing": user_cubes[i].pop(); user_cubes[i].pop(); and thanks for the nice greeting into the forums, I am glad to have a place to consult about my PIXI development problems Edited February 15, 2020 by IH121 ivan.popelyshev 1 Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted February 15, 2020 Share Posted February 15, 2020 > I expected the visual propety to be deleted, removed from the stage. Sorry, I dont understand you. Is it visible on screen? Are you sure its child of stage and not a grandchild? Quote Link to comment Share on other sites More sharing options...
IH121 Posted February 15, 2020 Author Share Posted February 15, 2020 5 minutes ago, ivan.popelyshev said: > I expected the visual propety to be deleted, removed from the stage. Sorry, I dont understand you. Is it visible on screen? Are you sure its child of stage and not a grandchild? yes it's visable on the screen, and I am sure it's not the grandchild becuase I was able to remove it using the chrome console. Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted February 15, 2020 Share Posted February 15, 2020 (edited) It should work, I have no idea what is wrong there. Place a breakpoint in that place and see if removeChild affects children array. If you are too tired to debug , then reduce a demo to minimal lines of code and post it on codepen/jsfiddle/pixi-playground. Edited February 15, 2020 by ivan.popelyshev Quote Link to comment Share on other sites More sharing options...
IH121 Posted February 15, 2020 Author Share Posted February 15, 2020 37 minutes ago, ivan.popelyshev said: It should work, I have no idea what is wrong there. Place a breakpoint in that place and see if removeChild affects children array. If you are too tired to debug , then reduce a demo to minimal lines of code and post it on codepen/jsfiddle/pixi-playground. I'll try to to reduce the number of lines, I never quite captured the idea of the chrome debugger. but before I do, your suggestion gave me an idea, I might try to examine the stage property. ivan.popelyshev 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.