- Home /
Collision.gameObject doesn't necessarily return the GameObject whose collider we are colliding with - implementation bug or documentation bug?
The documentation states Collision.gameObject returns the GameObject whose collider we are colliding with. However, in the case that the collider is attached to a child whose parent contains the Rigidbody, Collision.gameObject actually returns the parent (i.e. the GameObject which contains the Rigidbody which is managing the collider).
Is this behaviour a bug, or is the documentation incorrect? I don't want our game to start behaving differently if this behaviour is changed in line with the documentation in a future version of Unity.
Thanks.
colliders belong to the rigidbody up the chain
you're right the doco could be even more clear - but that's true of all doco
It is staggeringly unlikely you would have found such a basic bug in easily the world's most popular, most deeply developed, most used game engine - don't you think realistically ??
No need to be patronising! Since the observed behaviour is at odds with the documentation, I was just hoping for some clarification from one of the Unity devs. It's frustrating when a working project breaks due to an engine update changing the behaviour of an API, as I know all too well from Unreal Engine.
To address your final point, basic bugs can and do creep into major releases, so to deem it "staggeringly unlikely" seems a little over-the-top. I was even bitten by such a bug in Unity just the other day (enabling mesh compression causing dynamic batching to stop working).
I don't understand you use years of developing on 1 game than you update the engine and you don't even know what you update and what for
everything worked before I never see a reason to update a system untill it's broken ESPECIALLY WINDOWS I hate them and I format them when they break as they aren't STABLE - they never were
Your answer
![](https://koobas.hobune.stream/wayback/20220613095916im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
WALL collision detection problem... help!!!! 0 Answers
KnockBack Effect. 1 Answer
How do i destroy only 1 object when 2 instances of the same object collide ? 2 Answers
Trouble with collisions 1 Answer