Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma strict
- var KeyIsPressed = false;
- var gun1 : GameObject;
- var gun2 : GameObject;
- function Update () {
- if(Input.GetKeyDown(KeyCode.E)){
- if(KeyIsPressed)
- KeyIsPressed = false;
- else
- KeyIsPressed = true;
- }
- if(KeyIsPressed) {
- gun1.gameObject.SetActive(false);
- gun2.gameObject.SetActive(true);
- }
- if(!KeyIsPressed) {
- gun1.gameObject.SetActive(true);
- gun2.gameObject.SetActive(false);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment