11-17-2015, 08:27 PM
I have used the Profiler.. and looked into some things.. here is what I have just checked a few minutes ago:
- went into "CreateMesh.cs" - changed createMeshes() to coroutine - updated this part as such:
- after that, same thing done to UpdateColliders() - updated to this:
These changes already diminished the problem by a large margin. It also did implicitly create a visible update sequence (I could see parts of the road being updated, one after the other - instead of the whole thing - makes sense).
There's other places that could benefit from the same idea I guess, but I don't really have a good enough overview of how everything is put together, so.. if I for instance change the WaitForSeconds to ".4f", there's a big delay to setting colliders.. clearly there's more synchronization needed for everything to work.
Anyways, based on the current results, I do believe it is the way to go for better performance.
- went into "CreateMesh.cs" - changed createMeshes() to coroutine - updated this part as such:
Code:
for (int vm = 0; vm < MY_MESH.Count; vm++)
{
if (MY_MESH[vm].Count < 65535)
{
CGVMesh vmesh = MY_MESH[vm];
writeVMeshToMesh(ref vmesh);
}
else
exceededVertexCount++;
yield return new WaitForSeconds(.2f);
}
- after that, same thing done to UpdateColliders() - updated to this:
Code:
for (int r = 0; r < m_MeshResources.Count; r++)
{
if (!m_MeshResources.Items[r].UpdateCollider(Collider, Convex, Material))
success = false;
yield return new WaitForSeconds(.2f);
}
These changes already diminished the problem by a large margin. It also did implicitly create a visible update sequence (I could see parts of the road being updated, one after the other - instead of the whole thing - makes sense).
There's other places that could benefit from the same idea I guess, but I don't really have a good enough overview of how everything is put together, so.. if I for instance change the WaitForSeconds to ".4f", there's a big delay to setting colliders.. clearly there's more synchronization needed for everything to work.
Anyways, based on the current results, I do believe it is the way to go for better performance.