Problem after renaming class/script

Hello,

after I renamed a class and script name as shown in the lesson, just to try, I’ve noticed that the 2D physics is not working anymore!

For example: the ball I previously created won’t be “launched” and neither will fall down, and the same happen with any new RigidBody2D I create. Rigid bodies just stick where they are.

There is no error reported in play mode, everything else seems to work fine. What could be the problem?

Thanks
S.

Hi Salvatore,

Welcome to our community! :slight_smile:

First of all, please check if the script is still attached to your ball. Since Unity components are sometimes buggy for no apparent reason, you could try to remove the script from the Inspector and reattach it.

Also double check the spelling inside your script because C# is case-sensitive. For example, the class for the rigidbody 2D is named Rigidbody2D.

If the ball does not move along with the paddle, make sure that the paddle from the Hierarchy is referenced by the Ball, not the prefab from your Assets folder.

I hope this helps. :slight_smile:

Hello Nina,

I’ve checked all scripts and re-attached them again, but nothing changes. Even if I create a new Rigid body from scratch it doesn’t work.

I tried to start a new project and import all the prefabs and scripts one by one, and in the new project everything works… still have no clue on what is happened in the original project.

Thanks a lot
S.

Could you perhaps share more information on the project that is not working, e.g. screenshots, your code, etc.? There must be a difference somewhere.

This topic was automatically closed after 14 days. New replies are no longer allowed.

Privacy & Terms