x


Error when using GetComponent<> in a C# script, on a javascript

Hello,

I'm currently making a little script that switches between two cameras. One camera is written in C# (MouseLook) and the other in Javascript (SmoothFollow)

When I use GetComponent<SmoothFollow>().enabled = false;

I get the error The type or namespace name 'SmoothFollow' could not be found. Are you missing a using directive or an assembly reference?

Somewhere else I'm using GetComponent<MouseLook>().enabled = false;

And that works just fine.

more ▼

asked Jun 01 '11 at 08:29 PM

Simon V gravatar image

Simon V
138 16 22 28

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

1 answer: sort voted first

You will need to place the js script in the Standard Assets folder or Plugins folder. See unity documentation for more info. http://unity3d.com/support/documentation/ScriptReference/index.Script_compilation_28Advanced29.html

more ▼

answered Jun 01 '11 at 08:33 PM

TowerOfBricks gravatar image

TowerOfBricks
3.2k 17 25 50

This works just fine ;) Thanks!

Jun 01 '11 at 08:38 PM Simon V
(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:

x4152
x3458
x405

asked: Jun 01 '11 at 08:29 PM

Seen: 3662 times

Last Updated: Jun 01 '11 at 08:38 PM