A global OnJointBreak()?

Say I have 500 GameObjects with Hinge Joint components and I would like to know when their joints break … but I would very much like to avoid adding another 500 MonoBehaviours to the scene with the sole purpose of getting access to the local OnJointBreak() calls.

Is there any way I can be noticed globally by the physics engine when a joint breaks?

Anyone?
~ce

I don’t think there is any global OnJointBreak equivalent. I guess you could use GameObject.AddComponent to add a detection script to each hinge object. This would avoid the manual effort of attaching the scripts, but maybe you are more concerned about the runtime overhead?

Thanks for the reply Ande.

Sorry if I was unclear. No I wasn’t thinking of manually attaching 500 scripts in the first place (just take a little moment to contemplate the pain). =)

It is solely a performance issue.

Amazing though it sounds, there are actually people who attempt things like this from time to time :wink:

Ir’s not as nice and clean as an override function, but this worked for me.

http://forum.unity3d.com/viewtopic.php?p=263031#263031

Thanks for the tip eekllc! It’s not exactly what I hoped for, but might be better than 500 MonoBehaviours.