It’s been a whole two weeks now with my fullscreen bug, and it seems that no one cares anymore, and I can’t seem to figure it out myself, now I have updated my code to better fit the toggle button, and I get a total of 13 errors in this order:
A ‘using’ directive can only be applied to namespaces but ‘UnityEngine.Screen’ denotes a type. Consider using a ‘using static’ instead “Line 4”
Feature ‘using static’ cannot be used because it is not part of the C# 4.0 language specification “Line 4”
Unexpected symbol ‘public’, expecting ‘,’ or ‘;’ “Line 5”
The contextual keyword ‘var’ may only appear within a local variable declaration “Line 15”
‘UnityEngine.Screen’ does not contain a definition for ‘fullscreen’ “Line 15”
‘UnityEngine.Screen’ does not contain a definition for ‘fullscreen’ “Line 16”
‘UnityEngine.Screen’ does not contain a definition for ‘fullscreen’ “Line 17”
The left hand side of an assignment must be a variable, a property or an indexer “Line 26”
The left hand side of an assignment must be a variable, a property or an indexer “Line 27”
The left hand side of an assignment must be a variable, a property or an indexer “Line 28”
‘UnityEngine.Screen’ does not contain a definition for ‘fullscreen’ “Line 31”
‘UnityEngine.Screen’ does not contain a definition for ‘fullscreen’ “Line 32”
‘UnityEngine.Screen’ does not contain a definition for ‘fullscreen’ “Line 33”
Errors are killing me slowly, but here is the code so you can possibly help:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class FullscreenToggle : MonoBehaviour
{
// Use this for initialization
void Start()
{
}
// Update is called once per frame
void Update()
{
if (!Screen.fullscreen)
{
if (Input.GetMouseButtonDown(0))
{
RaycastHit hit;
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
if (Physics.Raycast(ray, out hit, 100.0f))
{
//Replace this with whatever logic you want to use to validate the objects you want to click on
if (hit.collider.gameObject.tag == "Toggle")
{
!Screen.fullScreen = Screen.fullScreen;
}
}
}
}
if (Screen.fullscreen)
{
if (Input.GetMouseButtonDown(0))
{
RaycastHit hit;
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
if (Physics.Raycast(ray, out hit, 100.0f))
{
//Replace this with whatever logic you want to use to validate the objects you want to click on
if (hit.collider.gameObject.tag == "Toggle")
{
Screen.fullScreen = !Screen.fullScreen;
}
}
}
}
}
}
Not to be rude or anything, but someone please answer this question this time, this is my fourth time I’ve asked a question related to my games fullscreen bug and not a single person has replied. And at this point I’m done. >:-(