Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Bug / Crash  obi rope breaks after build.
#6
(27-09-2023, 05:56 PM)josemendez Wrote: Hi,

Where do these scripts change the rigidbody velocity? Do they do it in FixedUpdate()?


This really sounds like your scripts are changing rigidbody velocities in FixedUpdate(), and Obi's FixedUpdater is also doing the same. As I mentioned in the previous post the order in which Unity calls MonoBehavior events for different scripts is undefined by default (essentially random), so either the rope will overwrite the velocities set by your script or the other way around. Depending on things like editor/build, or which component/object gets activated last, the order will change.

To check if this is the case, subscribe to ObiSolver.OnEndStep and place a Debug.Log there, then place a Debug.Log in your script's FixedUpdate. The order in which these are written to the console will probably change between the build and the editor.

Assuming this is the problem, there's many solutions to it. Simplest is to set your script execution order explicitly. Another one would be to subscribe to one of the solver's callbacks and change the rigidbody velocities there, so that the order is consistent.

kind regards,
Indeed, I zedebagged and the reason was that ObiRope affects RigitBody at the same time as another Monobehaviour apparently in FixedUpdate. The script execution order solved the problem.
Most Solver callbacks were after execution of FixedUpdate on other MonoBehaviour. Such as OnSubstep I didn't even check because it is very common, I assume it will be even more common than FixedUpdate.
Anyway, this topic will serve as a great guide to solving bugs when using ObiRope with other assets (Invector in my case)
Thanks!
Reply


Messages In This Thread
obi rope breaks after build. - by Alexander34 - 27-09-2023, 09:22 AM
RE: obi rope breaks after build. - by josemendez - 27-09-2023, 02:01 PM
RE: obi rope breaks after build. - by Alexander34 - 27-09-2023, 02:26 PM
RE: obi rope breaks after build. - by Alexander34 - 27-09-2023, 03:42 PM
RE: obi rope breaks after build. - by josemendez - 27-09-2023, 05:56 PM
RE: obi rope breaks after build. - by Alexander34 - 28-09-2023, 11:09 AM