+1 vote

Godot 3.0.3
Godot documentation gives an example class "resourcequeue.gd" in chapter "Background loading".
There is a function "
waitforresources":

func _wait_for_resource(res, path):
_unlock("wait_for_resource")
while true:
    VS.flush()
    OS.delay_usec(16000) # wait 1 frame
    _lock("wait_for_resource")
    if queue.size() == 0 || queue[0] != res:
        return pending[path]
    _unlock("wait_for_resource")

that should wait until the resource is loaded by a separate thread "thread_process".

The code does not work because

VS.flush()

will throw an error because VS does not exist. Also an OS.flush does not exist.
When removing this line from code the system crashes, probably a deadlock, because this function will loop forever.

Has anybody had success with this example or does anybody know what "VS.flush()" means ?

in Engine by (18 points)

cant delete comment, see answer below...

2 Answers

0 votes

it was changed to VisualServer.sync()
VS.flush() is used for under Godot 2.x

by (9,509 points)
edited by
0 votes

I am trying to do the same in 2.1.5 according to the documentation and VS.flush() is not available. Using VS.sync() does not seem to work either although the method exists. Workaround anyone?

by (26 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.

Categories