Enter full screen on Computer without a new scene

Hi, I’m trying to make a computer that your able to click on and go full screen in, but you can click back out of to go back to the room, but also be able to click back in it, if anyone can help and actually success and test their script, It’d be greatly amazing! Thank you!

C# or just Java~

This will do the trick

using UnityEngine;
using System.Collections;

public class ToggleObjectScale : MonoBehaviour
{
    private bool objectMaximised = false;
    private Vector3 norlmalScale = Vector3.zero;
    private Vector3 maxScale = Vector3.zero;

    void Start()
    {
        norlmalScale = gameObject.transform.localScale;
        maxScale = new Vector3(Screen.width / norlmalScale.x, Screen.height / norlmalScale.y, norlmalScale.z);
    }

    void OnMouseDown()
    {
        if (objectMaximised)
        {
            gameObject.transform.localScale = norlmalScale;
        }
        else
        {
            gameObject.transform.localScale = maxScale;
        }
        objectMaximised = !objectMaximised;
    }
}

You need to make sure that there is a collider on the GameObject.

The thing is it will max the complete object. You may want to create an object that just represents the screen and attach this script to it. That way it will only enlarge the screen itself.

I did a quick test using a Quad and a sample material. Worked fine.

This is another version which is a little better

using UnityEngine;
using System.Collections;

public class ToggleObjectScale : MonoBehaviour
{
    private bool objectMaximised = false;
    private Vector3 norlmalScale = Vector3.zero;
    public Vector3 maxScale = Vector3.zero;

    public float distance = -10;
    public float goDepth = 0.3f;
    private Vector3 v3ViewPort = Vector3.zero;
    private Vector3 v3BottomLeft = Vector3.zero;
    private Vector3 v3TopRight = Vector3.zero;

    void Start ()
    {
        norlmalScale = gameObject.transform.localScale;

        goDepth = Camera.main.nearClipPlane;
        distance = Camera.main.transform.position.z;
        v3ViewPort.Set(0, 0, distance);
        v3BottomLeft = Camera.main.ViewportToWorldPoint(v3ViewPort);
        v3ViewPort.Set(1, 1, distance);
        v3TopRight = Camera.main.ViewportToWorldPoint(v3ViewPort);
        maxScale = new Vector3(v3BottomLeft.x - v3TopRight.x, v3BottomLeft.y - v3TopRight.y, goDepth);
    }

    void OnMouseDown()
    {
        if (objectMaximised)
        {
            gameObject.transform.localScale = norlmalScale;
        }
        else
        {
            gameObject.transform.localScale = maxScale;
        }
        objectMaximised = !objectMaximised;
    }
}