- Home /
Holding down 'M' for map?
So i thought this would be simple enough, but turns out it clashes with my camera code,
i was thinking that if(Input.GetKeyDown("m")) was over case 0 of the camera change, and if(Input.GetKeyUp("m")) was over case 1 then in 'theory' that would invoke the need to keep hold of the button in order to view the 'map'.... but apparently not as it can then no longer identify case, or 1, and asks for a semi-colon and all sorts?
is there any way around this:
function Update ()
{
if(Input.GetKeyDown("m"))
{
//Debug.Log('pressing key');
currCam = (currCam + 1) % 2;
switch(currCam)
{
case 0 :
camera1.enabled=true;
aerialCamera.enabled=false;
break;
case 1 :
Debug.Log('pressing another key');
camera1.enabled=false;
aerialCamera.enabled=true;
break;
}
}
}
Answer by mattssonon · Oct 03, 2013 at 10:00 AM
Why not just do something like this:
function Update()
{
if(Input.GetKeyDown("m")) {
camera1.enabled=true;
aerialCamera.enabled=false;
}
if(Input.GetKeyUp("m")) {
camera1.enabled=false;
aerialCamera.enabled=true;
}
}
Seems like a solid idea, but now the camera doesnt change at all
Your answer
Follow this Question
Related Questions
troubles with changing scenes 3 Answers
camera movement problem? 1 Answer
FPS animate camera look up/down 0 Answers
How can I keep a player inside the camera box? [C#] 3 Answers