Quantcast
Channel: Questions in topic: "javascipt"
Viewing all articles
Browse latest Browse all 1875

Function not responding to GetKeyDown

$
0
0
I am trying to make a first/third person game but when ever i click the key i c or any other key i set it to it doesn't respond. #pragma strict var FPScamera : Camera; var Tpcamera : Camera; private var camswitch : boolean = false; function start() { FPScamera.GetComponent(Camera).enabled = true; Tpcamera.GetComponent(Camera).enabled = false; } function update() { if(Input.GetKeyDown("c")) { camswitch = !camswitch; } if(camswitch == true) { FPScamera.GetComponent(Camera).enabled = false; Tpcamera.GetComponent(Camera).enabled = true; } else { FPScamera.GetComponent(Camera).enabled = true; Tpcamera.GetComponent(Camera).enabled = false; } }

Viewing all articles
Browse latest Browse all 1875

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>