Is there any difference between
void OnCollisionEnter()
{
}
and
private void OnCollisionEnter(Collision collision)
{
}
They are both working as intended but I am curious as to what is the difference between both of them.
Is there any difference between
void OnCollisionEnter()
{
}
and
private void OnCollisionEnter(Collision collision)
{
}
They are both working as intended but I am curious as to what is the difference between both of them.
The default accessibility level in C# for a method is private, whether you explicitly write private or not makes no practical difference.
Are you sure about that? My understanding is that the one that accepts a Collision parameter is the correct one, and Unity will only invoke that one.
If Unity does invoke the one without a parameter, the only difference is that you now don’t have any collision data to work with within your method.
thanks! So yes, there is actually a difference between them and I found it out later.