- Home /
Mock Collision Object in Unity
Problem:
I'm trying to set up some tests with mock collision objects, but i cannot construct collisions with custom objects. What I'm trying to do:
Collision2D col = new Collision2D();
col.gameObject = this.gameObject;
There seems to be no way to do this as col.gameObject has no visible setter. Is there a way to do this? I would like to script the passing of a collision to a mono-behavior via an event that gets handled by the OnCollisionEnter2D(Collision2D collision) inherited from mono-behaviors. Thanks for your time.
p.s. I originally posted this here: http://gamedev.stackexchange.com/questions/88062/mock-collision-object-in-unity
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
Collision on specific Frames 1 Answer
OnCollisionEnter for translating gameObjects? 2 Answers
How to detect collision on only one side of an object? [C#] 4 Answers