Question by
Wolv15 · Dec 14, 2015 at 09:11 PM ·
threadingmultithreading
Multithreading - threads using main thread
I'm making minecraft-like game and I want to implement threading in my game to load chunk without performance drop BUT I did thread building voxels and chunk + perlin noise. Map started to loading a lot faster but I still get high main thread usage. My fps drop form 90 to 20.Without threading it was 5/6fps. What am I doing wrong? StartGenerating is called from world script after instantiate prefab of chunk. When im only instantating prefabs and not render them and generate with perlin noise main thread has 90 fps no problemo.
public Chunk()
{
generateT = new Thread(GenerateChunk);
}
void Start()
{
filter = gameObject.GetComponent<MeshFilter>();
coll = gameObject.GetComponent<MeshCollider>();
}
public void StartGenerating()
{
generateT.Start();
}
void GenerateChunk()
{
//perlin and mesh - it is not using any of unity3d stuff
}
Comment