You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My main thread is sending out a ECMAscript class as a message to a worker thread using godot.abandon_value & godot.adopt_value, but I only get the godot object and cannot call any of the js methods on the class:
// parcel.tsxexportdefaultclassParcelextendsgodot.Spatial{test_function(){console.log("stuff I wana run here"))}}// worker.jsonmessage=function(e){letparcel=godot.adopt_value(e.parcel)console.log(parcel)// [Spatial:2362]console.log(parcel.test_function())// undefinedconsole.log(parcel.call("test_function"))// error}// grid.tsxexportdefaultclassGridextendsgodot.Spatial{featureLoadThread_ready(){letp=newParcel()this.featureLoadThread=newWorker('res://src/worker.js')this.featureLoadThread.onmessage=this._onmessage.bind(this);this.featureLoadThread.postMessage({type:"featureLoad",parcel: godot.abandon_value(p)})}}
The text was updated successfully, but these errors were encountered:
You can only pass primitive values between workers. It is the standard and
limit of the JavaScript language, this why the adopt_value exists.
Joran Kikke ***@***.***>于2021年8月15日 周日10:00写道:
My main thread is sending out a ECMAscript class as a message to a worker thread using
godot.abandon_value
&godot.adopt_value
, but I only get the godot object and cannot call any of the js methods on the class:The text was updated successfully, but these errors were encountered: