问题描述
Cannot find member “window_fullscreen” in base “OS”.
回溯方法
func _input(event):
if event.is_action_pressed("toggle_fullscreen"):
OS.window_fullscreen = !OS.window_fullscreen
get_tree().set_input_as_handled()
问题截图
解决方案: 实现toggle_fullscreen函数 并替换掉 OS.window_fullscreen = !OS.window_fullscreen
toggle_fullscreen 方法实现
func toggle_fullscreen():
if DisplayServer.window_get_mode() == DisplayServer.WINDOW_MODE_WINDOWED:
DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_FULLSCREEN)
else:
DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_WINDOWED)