Quantcast
Channel: Questions in topic: "gun"
Viewing all articles
Browse latest Browse all 592

Make camera fit screen

$
0
0
How do I make the camera fit the GUI/screen? var texScope: Texture; // drag the scope image here var scopeCam: Camera; // drag the scope camera here var rCamera = Rect(0, 0, 196, 196); var rScope = Rect(0, 0, 308, 308); var enableAim: boolean = false; // set enableAim to true to aim function OnGUI(){ if (enableAim){ rCamera = ((Rect(0,0, Screen.width, Screen.height))); rScope = (Rect(0,0, Screen.width, Screen.height)); scopeCam.pixelRect = rCamera; scopeCam.enabled = true; GUI.DrawTexture(rScope, texScope, ScaleMode.ScaleToFit, true, 0); } else { scopeCam.enabled = false; } } function Update(){ enableAim = Input.GetMouseButton(1); // aim while the right mouse button is pressed }

Viewing all articles
Browse latest Browse all 592

Trending Articles



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