Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Toggling fullscreen in update() of gui script creates error #91

Closed
8bitskull opened this issue Jan 31, 2019 · 5 comments
Closed

Toggling fullscreen in update() of gui script creates error #91

8bitskull opened this issue Jan 31, 2019 · 5 comments
Labels

Comments

@8bitskull
Copy link

Hi! This is asvegren from the Defold forums.

First of all - massive thanks for this amazing extension.

I have encountered an issue using defos.set_fullscreen(bool_value) and defos.toggle_fullscreen(). I have a gui component that deals with various game settings, including full screen. I noticed that toggling full screen interrups the completion of the rest of the update() cycle in my gui script.

When I click the fullscreen button in my script (which immediately triggers defos.toggle_fullscreen()), the next gui node accessed using gui.get_node() is not found, yielding an error like this:
ERROR:SCRIPT: /HUD/settings/settings.gui_script:19: No such node: scaling_bg

scaling_bg in this example isn't actually deleted however.

I've realised that I don't have any issue if I just move my fullscreen toggle check to the end of the update() cycle (thereby not accessing any more gui nodes), however I thought I would raise this just in case it's important for anyone else.

@britzl
Copy link
Collaborator

britzl commented Jan 31, 2019

Hmm, that is quite surprising behaviour to be honest! I'm not sure what could be causing it. I guess you could post a message to yourself when you detect the click in on_input() and handle the message in on_message() where you call triggers defos.toggle_fullscreen().

@subsoap
Copy link
Owner

subsoap commented Feb 1, 2019

I agree with @britzl you probably will be able to deal with this best by sending a message to itself or another script to do the toggling on getting the message to avoid any interrupt. But you should also try to make a minimal reproducing example for us to test and see what's really going on.

What OS is this happening on?

@8bitskull
Copy link
Author

8bitskull commented Feb 6, 2019

Thanks for the suggestions on sending messages to shift where the call happens.

I am getting this error on Windows 7.

I tried making a reproducing example, but am failing to do so. The example I am pasting below is indicative of what happens in my main project and should trigger the error, but doesn't. I suppose that means either I'm misunderstanding the cause or there is something else interacting in my main project.


function init(self)
	full_toggled = false
end

function update(self, dt)

	if not full_toggled then

		print("getting:", gui.get_node("box1"))

		defos.toggle_fullscreen()

		full_toggled = true

		print("getting:", gui.get_node("box2"))

	end

end

@britzl
Copy link
Collaborator

britzl commented Jan 24, 2021

@8bitskull is this still happening?

@britzl britzl added the windows label Jan 24, 2021
@8bitskull
Copy link
Author

I reset the offending script to its original configuration and can no longer reproduce the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants