Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- public class ToggleFullscreen : MonoBehaviour {
- public Texture2D zoom_off;
- public Texture2D zoom_on;
- private Vector3 mp;
- public float indent;
- // Use this for initialization
- void Start () {
- }
- // Update is called once per frame
- void Update () {
- switchTexture();
- if (Input.GetMouseButtonUp(0)){
- mp = Input.mousePosition;
- if (guiTexture.HitTest(mp)){
- Screen.fullScreen = !Screen.fullScreen;
- Screen.SetResolution (Screen.currentResolution.width, Screen.currentResolution.height, true);
- }
- }
- }
- void switchTexture(){
- if(Screen.fullScreen)
- guiTexture.texture = zoom_off;
- else
- guiTexture.texture = zoom_on;
- guiTexture.pixelInset = new Rect(-17.5f,-(Screen.height/2-indent),32f,32f);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement