Click here to Skip to main content
15,913,685 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I was following a tutorial and i did everything the same as him but i still got a error CS1061. This is what it said in the console.

Assets\PlayerCollision.cs(11,33): error CS1061: 'Collision' does not contain a definition for 'collidor' and no accessible extension method 'collidor' accepting a first argument of type 'Collision' could be found (are you missing a using directive or an assembly reference?)



Here is the script:


using UnityEngine;

public class PlayerCollision : MonoBehaviour
{

    void OnCollisionEnter (Collision collisionInfo)
    {
        Debug.Log(collisionInfo.collidor.name);
    }





}


What I have tried:

I have tried to delete the script and write it again but it didnt work.
Posted
Updated 23-Jun-20 4:42am
Comments
[no name] 23-Jun-20 10:32am    
Simply a typo?
collisionInfo.collider.name
instead of
collisionInfo.collidor.name

The error message is pretty explicit:
'Collision' does not contain a definition for 'collidor' and no accessible extension method 'collidor' accepting a first argument of type 'Collision' could be found
And what it means is what it says: the class Collision does not contain a property called collidor

Remember, c# is case sensitive, so collidor is not the same as Collidor - so check the class to see what is defined.

Or perhaps it's miss-spelled? Again, check the Collision class to see what is available.

While you are there, check the access modifier on the property: if it is private for example, it is only accessible within the Collision class.
 
Share this answer
 
According to Unity - Scripting API: Collision[^]

I think it is simply a typo and should be
collisionInfo.collider.name

instead of
collisionInfo.collidor.name
 
Share this answer
 
Comments
Hand Cubing 24-Jun-20 6:19am    
Thank you so much i didnt notice because my english sucks. Thanks alot :)
[no name] 24-Jun-20 6:33am    
You are welcome.
"because my english sucks": Mine too. Servus ;)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900