x


Debug.Log error

Sorry this is a total newby question. I am doing my first scripting, when I click on a cube (GameObject) it should inform me "this object was picked" my script looks like this:

function OnMouseDown () { Debug.Log ("This object was picked"); }

I get a message saying "The Referenced script on this behaviour is missing!" Can you tell me what I am doing incorrectly?

more ▼

asked Jan 25 '12 at 04:06 AM

Nancy gravatar image

Nancy
1 2 2 3

(comments are locked)
10|3000 characters needed characters left

2 answers: sort newest

Attach the Object to the script in the inspector. Make sure all the objects are attached to the script.

Good luck!

more ▼

answered Jan 25 '12 at 04:56 AM

venkspower gravatar image

venkspower
284 18 25 27

(comments are locked)
10|3000 characters needed characters left

Look on that object in the inspector panel where the script should be.
If it says [checkbox]Mono Behaviour and then under that it says Script None(Mono Script) then your script isn't assigned for some reason. You might have deleted it, then made a new one with the same name and expected it to be there still, or something... whatever happened, it's missing, so click on that script area and assign one to the slot, or drag the one you want over there from the project panel and drop it on.

Edit :
You should re-title your question for search-purposes also, since this isn't an error with Debug.Log.

Added Note :
It could be any object in your scene missing a script for some reason like I said above, it isn't necessarily the object you're trying to mouse-click on. Maybe you deleted a script somewhere and still have another object in the scene that had it assigned to it, so now it doesn't have it anymore.

more ▼

answered Jan 25 '12 at 04:11 AM

Lo0NuhtiK gravatar image

Lo0NuhtiK
3.5k 1 10 39

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x3419
x2030
x135

asked: Jan 25 '12 at 04:06 AM

Seen: 572 times

Last Updated: Jan 25 '12 at 04:56 AM