![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | DrPlamsa |
![]() |
Old Version | Published before Godot 3 was released. |
Hello there! I’m making new threads to improve performance and load some terrain in the background. I was testing out threads when I found the following problem:
I have this function in World:
func test_threads():
var newchunk=MeshInstance.new()
newchunk.set_script(load("res://chunk.gd"))
var mythread=Thread.new()
var err
err=mythread.start(newchunk,"test_threads","butt")#Need to pass user data
var a=mythread.wait_to_finish()
Then this function in chunk.gd:
func test_threads(userdata):
print("chunk.test_threads got run")
var mesh=Mesh.new()
return userdata
And this crashes! Some other cases:
Remove var mesh=Mesh.new()
→ it runs fine
Change to var mesh=MeshInstance.new()
→ It crashes
Change to var mesh=Resource.new()
→ It runs fine
So do we know of this problem? Can anyone else make a mesh from a new thread?