Collisons compiler error -- OnTrigger2D

I don’t know if I missed something in a previous lesson or the videos are not quite updated, but at the time of this video, I didn’t have a Collison.cs script, but in the video it was already there. I don’t remember the discussion on that, or if that was part of the challenge–creating the script for it. Either way, I created the Collision.cs script asset, did it exactly as shown in the video, but I get compiler errors with it. Not sure if I am supposed to attach the script to the car or to the rectangle to make this debug work.

Hi,

Welcome to our community! :slight_smile:

We create the Collision.cs class in video “Using OnCollisionEnter2D()” and also attach the script component to the player in that video. Your thread is tagged with “11_dd_uy2”, which is the subsequent video. Maybe the previous lecture was skipped?

If you get an error message because of the classname “Collision”, rename the class and the file to “CollisionHandler” or something like that. The UnityEngine namespace already contains a class named Collision; that’s why the compiler might be complaining. However, without knowing anything about your project and what you see on your screen, that’s just a guess.


See also:

Thank you! It seems I some how skipped that video! Thank you.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms