+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 ?

asked Jun 26, 2018 in Engine by Galileo53 (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

answered Jun 26, 2018 by volzhs (9,234 points)
edited Jun 26, 2018 by volzhs
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?

answered Aug 25, 2018 by meigel (24 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.