error on Angry Birds tutorial

Hello community!

I’m new on Unity and I just started to use it. I watched the tuto on “Angry Bird” game like (http://unity3d.com/learn/tutorials/modules/beginner/live-training-archive/making-angry-birds-style-game?playlist=17093) but after the first part it doesn’t work. I think it comes from my script.

Here is the error I have when I launch the game and ty t control the asteroid :
MissingReferenceException: The object of type ‘SpringJoint2D’ has been destroyed but you are still trying to access it.
Your script should either check if it is null or you should not destroy the object.
ProjectileDragging.OnMouseDown () (at Assets/Scripts/ProjectileDragging.cs:66)
UnityEngine.SendMouseEvents:smile:oSendMouseEvents(Int32)

My script is in the “Attached Files”.

I also put a screeshot of what the game looks like when I luanch it.

I hope somebody could help me! :slight_smile:


2358136–159854–ProjectileDragging.cs (2.68 KB)

Can you post your script here using code tags. Most people don’t download files.
But first check the script because somewhere in it you are destroying something that has your spring joint on it so when you try to do something that is trying to access the spring joint the system fails.

It’s okay, I rewrite my script and it’s all good, I did a bad mistake of = in place of a -. If yu follow correctly the tuto it’s gonna be okay guys :wink:

In the future, if you have a problem with a Live Training session, you can post in Teaching / Free Online Training. We try to support all of our learn material. For extending one of the sessions, we prefer people ask in the appropriate section, such as 2D for Angry Birds-like… but for help getting the base project to work - you can post in Teaching.