x


Getting Error Object reference not set to an instance of an object

Hello,

Im getting an error of: 'Object reference not set to an instance of an object' on my MouseLook Script. I Have supplied a picture of the error I'm getting:

alt text

This is a picture of the script I'm trying to get working:

alt text

If you know how to fix this, Please leave a comment below on how to do so!

Thanks!

more ▼

asked Aug 06 '12 at 10:10 PM

Raxis gravatar image

Raxis
27 3 11 14

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

1 answer: sort voted first

In my case, it is usually the below:

  1. You have declared a variable and applied an action to it in the update or start function but did not set what the variable in the inspector is.
  2. You have given an action to a variable inside a function but you have not chosen the object to apply the code to.
more ▼

answered Aug 06 '12 at 10:24 PM

Radon gravatar image

Radon
236 4 10 16

Umm, what do I change then?

Aug 06 '12 at 10:52 PM Raxis

Make sure that all the variables in your script are set to an object.

Aug 06 '12 at 11:27 PM Radon

Lol, sorry. I'm new to codeing. Do you know how to set variables to objects to get a MouseLook script going?

Aug 07 '12 at 05:49 AM Raxis
(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:

x3733
x3328
x1950
x1949
x3

asked: Aug 06 '12 at 10:10 PM

Seen: 323 times

Last Updated: Aug 07 '12 at 05:49 AM