Jump to content

Physics:SetCollisionCallback crash


Recommended Posts

Hello

I use a inst.Physics:SetCollisionCallback(OnCollide) and I would like to know if anyone else reported random crashes with this? It doesn't write anything in client.log and there's no scripting error in the function. It closes the game to desktop with zero warning or error.

On collision the function calls workable:Destroy if it has it. I suspect when the object is destroyed, the physics may sometimes remove itself too late and the game still fires the function for the prefab that no longer exists.

anyone know anything about this?

Link to comment
Share on other sites

I'm guessing it crashes because it's in the middle of a physics-step, so if you destroy one of the objects it can't do the other checks on that object it had queued up (or something like that). Try wrapping the Destroy-call in a DoTaskInTime(0, <your inline-function>) call to see if that's the problem. If not, try studying other projectiles.

  • Thanks 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...