Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  Disable rope inside animation event callback
#2
(10-04-2022, 01:21 PM)jacob Wrote: I tested to change DestroyImmediate to Destroy, currently everything works fine, but I'm fully aware of it is always recommended to use Destroy over DestroyImmediate, so I'm wondering you are intentionally use DestroyImmediate to prevent some unwanted behaviors, if so, should I keep using DestroyImmediate? And what are the workarounds for this problem? (except move my code to coroutine, it has to be synchronized at exact time in order to achieve my expected behavior)

You can't use Destroy() in editor. That's the reason why DestroyImmediate() is used instead, since the collision world might be destroyed in-editor when you switch simulation backends. Using Destroy() instead will cause all sorts of issues during edit mode, since multiple collision worlds will start to spawn in your scene.

If you intend to remove all actors from a solver during an animation, you might want to call Destroy or DestroyImmediate depending on whether you're in editor or play mode. You can use Application.isPlaying to check for this.
Reply


Messages In This Thread
RE: Disable rope inside animation event callback - by josemendez - 11-04-2022, 07:59 AM