Quantcast
Channel: Latest Questions on Unity Answers
Viewing all articles
Browse latest Browse all 171066

Camera enable/disable problem.

$
0
0
I have this car with some cameras and they need to be disabled when I exit it and enabled when I enter it and change camera view. However I need to use only 2 buttons in order to do it. One for getting in and out and 1 for changing. Ok so all that pretty much works except that after I exit the car all cameras get disabled on exiting with the same button that I enter the car with. So when I want to renter the car it disables the cameras. I would I stop it from disabling going in whilst making disable going out? Code: //This is on exiting. public Camera camera01; if(Input.GetKeyDown(KeyCode.E)){ camera01.enabled = false; } //This is on entering in the player script, the exiting is on the cars script. // the CarComp is the script that gets enabled and along with the cameras attached to it. This is the script from above. if(Input.GetKeyUp(KeyCode.E)){ vehicle.Getcomponent().enabled = true; } So again my problem is that I need the the E button to not disable cameras on getting into the car but do disable them while getting out.

Viewing all articles
Browse latest Browse all 171066

Trending Articles



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