x


disabling camera script

I am trying to do a pause button on my game, and i want the camera to stop moving, i tied to disable the component but it says enabled its not a part of UnityEngine.GetComponent. so here is the pause script(its attached to the camera as well as the Mouse Look):

#pragma strict

var isPaused : boolean = false;
var PauseGUI : GUI;
PauseGUI.enabled = false;

function Update (){
 if (Input.GetKeyUp(KeyCode.P)){
 if (isPaused){
 isPaused = false;
 }
 else{
 isPaused = true; 
 }
 }

 if (isPaused){
 Time.timeScale = 0.000001;
 PauseGUI.enabled = false;
 GetComponent("Mouse Look").enabled = false;
 }
 else{
 Time.timeScale = 1;
 PauseGUI.enabled = false;
 }



}

thank you all, and if you need more information plz tell me.

more ▼

asked Jul 21 '12 at 05:54 PM

thenachotech1113 gravatar image

thenachotech1113
131 2 15 26

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

3 answers: sort voted first
GetComponent("Mouse Look").enabled = false;

replace with

MouseLook ml = GetComponent("MouseLook");
ml.enabled = false;

AFAIK in JS this will look like

var ml : MouseLook = GetComponent(MouseLook);
ml.enabled = false;
more ▼

answered Jul 21 '12 at 07:09 PM

ScroodgeM gravatar image

ScroodgeM
7.6k 2 6

whell the error went away, still it says to insert a semicolon between GetComponent so anny idea of what could be wrong? btw its in java script so IDK what could have gone wrong

Jul 25 '12 at 01:14 AM thenachotech1113

i added version for JS. don't like it 8)

Jul 25 '12 at 05:05 AM ScroodgeM
(comments are locked)
10|3000 characters needed characters left

Pleese give normally work script!!!

more ▼

answered Aug 29 '12 at 12:38 AM

neduser gravatar image

neduser
-14

this is not a place to get free code, this is place to get answers to questions you have.

Aug 29 '12 at 09:53 PM ScroodgeM
(comments are locked)
10|3000 characters needed characters left

Thanks :-( but help very need. Project which created in historical faculty not normally work without script (as pause and so on). Studing C+ and Java is very difficult for some humanities. But 3d engine is very popular and needed tools in digital archaeology and historical research. Who any help?

For project - Virtual Reconstruction of Moscow Monastery «All Sorrow Joy» 1909 year http://hist.msu.ru/3D/Joy_of_all_sorrow.htm

Ph.D. Student Denis Zherebyatiev Lomonosov State University Historical faculty Historical Informational Science

more ▼

answered Aug 29 '12 at 11:41 PM

neduser gravatar image

neduser
-14

(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:

x3121
x2053
x1197
x268
x2

asked: Jul 21 '12 at 05:54 PM

Seen: 895 times

Last Updated: Aug 29 '12 at 11:41 PM