Procedural mesh generates undefined error

I’m trying to generate a procedural mesh but it keeps logging an error to the console that doesn’t actually explain what the error is.

UnityEngine.Component:GetComponent(Type)
UnityEngine.Component:GetComponent() (at C:\BuildAgent\work\6bc5f79e0a4296d6\Runtime\ExportGenerated\Editor\BaseClass.cs:630)
AnandamideSeedObject:setVertexPositions() (at Assets\Scripts\AnandamideSeedObject.cs:3327)
AnandamideSeedObject:ThreadedGenerateSeed() (at Assets\Scripts\AnandamideSeedObject.cs:5040)

The line of code it references in my class is
GetComponent().mesh = finalMesh;

The object has a meshfilter. When I put the offending line in the Awake() function, it instead gives me this error on
finalMesh.vertices = finalPositions;
or if I precede that line with a usage of finalMesh.vertexCount the error references that line.

komatii

It may help if you posted some more code.

The problem had something to do with multithreading. As soon as I set my mesh generation function to not call on it’s own thread it started working correctly. No idea why that was the issue, the multithreaded version worked fine in XNA.

The Unity API can’t be used in threads.

–Eric

There is no multithreading of any kind in Unity? If not, how are you supposed to take advantage of x360’s 3 cores or PS3’s 7?