Hi again! I'm trying to use one button to change the camera zoom from 11 to 16 to 20... So, each time I press the button I want it to jump from Zoom 11 -> 16 -> 20 (and back to 6) so its basically rotating...In my current script i've set 11f as "default" and I can change the cameraZoom by pressing 2 different buttons.. Any easy way to make a "rotating schedule" for the camera zoom? Code (csharp): public float camSize = 11f; void Start() // Update is called once per frame void Update() { if (Input.GetKey(KeyCode.I)) { camSize = 16f; } else if (Input.GetKey(KeyCode.O)) { camSize = 20f; } } Thanks in advnace!
For example something like this: Code (CSharp): if (Input.GetKey(KeyCode.R) { if(camSize==6f) { camSize=11f; } else if(camSize==11f) { camSize=16f; } else if(camSize == 16f) { camSize=20f; } else if(camSize == 20f) { camSize=6f; } }
Oh my god you made that looks so simple (Emoji slapping his face) - that worked perfectly Thanks alot!
You could also do something like: Code (CSharp): float[] _zoomLevels = new float[] { 6, 11, 16, 20 }; int _zoomIndex = 0; if(Input.GetKey(KeyCodes.R) { _zoomIndex++ if(_zoomIndex >= _zoomLevels.Length) _zoomIndex = 0; camSize = _zoomLevels[_zoomIndex]; }