I’m trying build a mesh on another thread. I’ve created my own object which inherits from Geometry. When I try to instantiate the object on another thread I get a cross thread error: Invalid cross-thread access.
Why is this? I’m not trying to add the mesh to the scene yet, and I’m not accessing any other controls to create the object (at least on my side) Is creating instances of Geometry objects on threads other than the UI thread not supported?
My current plan is to build all the necessary components (faces, verts, text cooards) and then pass them back, and have the actual mesh build on the main UI thread. Mostly I’m just curious why I can’t create a mesh on another thread. It’s
just data right?
My order of operations.
1) Get Game up and running with initial nodes.
2) At some point I detect I need to create a mesh(geometry). I create a thread, pass in the necessary data and create the geometry object.
3) I detect the geometry is finished building on the UI thread, at this point the thread I used to create the geometry is finished.
4) I take the geometry created and add it to the scene. This operation happens on the UI thread.
I can't get past step 2 because creating the instance of the geometry on another thread fails.