Block dosent get destroyed

Hey when the ball hits the block nothing happens but i done exactly the same as in the video.Please help me

Hi @Shlok_Jaiswal,

Welcome to our community! :slight_smile:

What do you mean by “nothing happens”? What did you expect to happen? What happened instead?

Hi Thanks for responding… The problem is when i launch the ball from the paddle it touches the block but not destroys it but i have done everything as rick did but still the block Dosen’t get destroyed.

Is a Block script attached to the block game object? Have you already compared your code to the Lecture Project Changes which can be found in the Resources of this lecture? Double check the collision method name. And add a Debug.Log to that method, so you can see in your console whether the method was called on collision.

Yes i have added the script but i will go check in the lecture project changes thanks again

I have checked in the lecture project changes i have the same code.

Could you please share your code as formatted text? And have you already tried to add Debug.Logs to your code to see what is going on during runtime? Are there any error messages in your console?

ok i am sharing my code.

I’m sorry for the late response, @Shlok_Jaiswal. For some reason, I missed that you replied here. Next time, if I don’t reply within 2 working days, please feel free to tag me in your thread with @Nina.

There is a typo on the method name. The correct name is OnCollisionEnter2D.

Did this help?


See also:

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

Privacy & Terms