Destroy Object Outside Screen Behaviour Doesn't Seem to be working

Not sure if its some error I’ve made or if its a bug. I’ve included the Destroy Outside Screen Behaviour for bullets but when I use the debugger the instances of the bullets don’t get deleted once they cross the screen boundaries.

1 Like

I think there’s a small margin after crossing the screen.
Can you see the position of bullets ?

1 Like

x > 20K , y > 30K

Not sure what is happening in the debugger but when counting the number of objects it is indicating the behavior is working:

bullet_count

Then the object exist in engine, but is not displayed ?

Count(object) should return the number of objects exist in the game not just the visible ones.
So according to this expression the object does not exist after left the screen. Could confirm that by looking in to the source how this expression works I guess.

Actually the debugger confirms too the objects are being deleted, I can not reproduce the problem on my side:
debugger

OK so it’s working well.
@danjam84 Can you upload your project file here ?

Ho do I do that? I only see an option to upload images.

You can use Firefox Send, Dropbox, Google Drive or similar and share the link to the file here.

I’m quite certain it’s some silly error on my side but here you go…

https://we.tl/t-09q77O50QI

1 Like

This is indeed broken in new projects.
When I open an old project the behavior does work, but when I create a new project it doesn’t.
The project file is corrupted.

This is how it looks like in old project files that works:
“behaviors”: [
{
“name”: “DestroyOutside”,
“type”: “DestroyOutsideBehavior::DestroyOutside”,
“extraBorder”: 0
}

And this is how it looks like in new project files that does not work indeed:

“behaviors”: [
{
“name”: “DestroyOutside”,
“type”: “DestroyOutsideBehavior::DestroyOutside”
}

@4ian it is missing the “extraBorder” parameter in new project files.

Fixed for next version.
Thanks @ddabrahim for spotting the issue :slight_smile:

As a work around, you can manually fix your games by adding “extraBorder” : 0 next to name and type. Be sure to make a copy of your game file before attempting this, so that you have a backup in case you break the file!!