- Home /
Question by
weenchehawk · Jul 28, 2014 at 08:12 PM ·
oncollisionenterbroadcastmessage
Using BroadcastMessage on OnCollisionEnter
Hey all, I need to fake an OnCollisionEnter() event, and ensure that every MonoBehavior attached to a given gameObject receives the event, and processes it just as if it were a real collision. I'd love to be able to do something like . . .
Collision NewCollision = new Collision();
NewCollision.collider = ObjectThatIspretendingToCollide.collider;
MyGameObject.BroadcastMessage.("OnCollisionEnter", NewCollision);
But I can't for some very good reasons . . .
I shouldn't screw with the Physics engine like this
Collision.collider is readonly (because of 1 above)
and many many other reasons which I just got tired of typing
So if somebody has a suggestion, I'd love to hear it.
As for why I want to do this . . . . well I've painted myself into a corner and rather than do an enormous rewrite, I want to see if I have any options.
Any suggestions gratefully received.
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220613155228im_/https://answers.unity.com/themes/thub/images/avi.jpg)