Blender Game Engine toggle FullScreen with script My 'FullScreen' script occurs an error.
Each time the object is clicked it activates the 'FullScreen' and then deactivates.

import bge
from bge import render

# Functions
def main():

    cont = bge.logic.getCurrentController()
    own = cont.owner

    # Action    
    if bge.render.getFullScreen() == False:
        bge.render.setFullScreen(True)
        return
    else:
        bge.render.setFullScreen(False)
        return

# Action        
main()
I test it and yeah it enter 'FullScreen' and then deactivates.

I assume that you was using a always sensor wich will trigger twice combined with a mouse click sensor.

To make it work the logic:



The script:

from bge import logic, render

left_click = logic.getCurrentController().sensors['MouseLC']
mouse_over = logic.getCurrentController().sensors['MouseOver']

if mouse_over.hitObject and left_click.positive:
    if render.getFullScreen():
        render.setFullScreen(False)
    else:
        render.setFullScreen(True)


If you want bge in front all instuctions.

import bge

left_click = bge.logic.getCurrentController().sensors['MouseLC']
mouse_over = bge.logic.getCurrentController().sensors['MouseOver']

if mouse_over.hitObject and left_click.positive:
    if bge.render.getFullScreen():
        bge.render.setFullScreen(False)
    else:
        bge.render.setFullScreen(True)


if you dont want left_clikc and mouse_over

import bge

if bge.logic.getCurrentController().sensors['MouseOver'].hitObject and bge.logic.getCurrentController().sensors['MouseLC'].positive:
    if bge.render.getFullScreen():
        bge.render.setFullScreen(False)
    else:
        bge.render.setFullScreen(True)