Run While Iconified error

Steps to reproduce:

  1. Start any project (or an empty clean proj)
  2. Check ‘Run While Iconified’ in project settings
  3. Run the app: Project/Build
  4. Minimize the app window

I am getting the following error continously:

ERROR:SCRIPT: /builtins/render/default.render_script:81: argument #1 contains one or more values which are not numbers: vmath.matrix4(inf, 0, 0, nan, 0, inf, 0, nan, 0, 0, -1, -0, 0, 0, 0, 1)
stack traceback:
	[C]: in function 'set_projection'
	/builtins/render/default.render_script:81: in function </builtins/render/default.render_script:57>
  1. Restore the window, and the errors will be gone… until you minimize the window again.

Tested on: Defold 1.2.169, Windows 10

1 Like

Can you create an issue here?

1 Like

Done! Thanks.

1 Like

A workaround for now might be to detect window focus loss, save that state to a Lua module shared between the render script and the script with the window focus callback (or put window callback in render script) and then skip the entire render steps when iconified.

.render_script

function update(self)
    if window_is_iconified then return false end
...

There are related events for window.set_listener()

edit:

render script context does not have access to window :thinking:

Here’s a sample of a workaround fix

WindowIconifiedError.zip (4.6 KB)

1 Like