[SOLVED] Broke my Paddle GameObject

When learning the part about dragging the duplicated Paddle in the Prefabs folder to make a Prefab. I accidentally didn’t make a duplicate. I then tried to delete the Paddle Prefab and my Paddle game object is now highlighted pink in the Hierarchy. My game won’t launch the ball anymore so I think the scripts maybe can’t find it anymore. Is there a way to revert it back to before I dragged it into Prefabs folder or do I need to make it from scratch again? Thanks in advance.

1 Like

It is just saying that it isnt linked to the prefab anymore, you will have to drag it to the hierarchy and configure it again to create a new prefab. The links between prefabs in the hierarchy are probably lost too.

But don’t worry, this kind of thing happens now and then.

1 Like

Hi, thanks for the swift reply. Im not really sure about how to configure it again. However I just want it back as it was, without an attached prefab with (black) text in the hierarchy. Also would the problem of deleting the prefab cause my Ball launch to break? as it worked before I had made any prefabs at all.

1 Like

What may happen is losing the link in the inspector between prefabs.
Just check every public variable within the inspector of this gameObject to see if some of then is null/empty

Also, what the console is displaying? It shows most of the bugs.

1 Like

43 am

Sorry i am pretty noob. with the (Ball.cs:15) is the 15 the line the problem is on?

Thanks for all your help so far

1 Like

Seems to have two problems, there is an variable being addressed in the 15th line of the ball script that is null. Probably in the inspector of the ball there is a variable exposedg that don’t have the value that should have, you have to drag the correct reference into this box. What is the name of the public variable in the 15th line?

The parameter within the OnCollisionEnter2D is wrong too, make sure to use Collision2D in the parentheses.

Let me know if this worked.

1 Like

Hi Joao,

Thanks for your help. those two issues were fixed with your diagnosis. My paddle script was missing from my Ball GameObject. It must have removed itself after I deleted the Prefab. And yes I had Collider2D in the parentheses instead of Collision2D. I must have been confused by the fact the method above that one has Collider2D in the parentheses.

Thank you kindly59 pm

2 Likes

Im glad for being able to help, let us know if you need something else

2 Likes

Privacy & Terms