Closed Keeetrab closed 5 years ago
Hmm...Haven't seen this and currently the Simplygon plugin for Unity is unsupported. What version of the plugin/Simplygon are you using?
I fixed the same problem.
I guess a reason of problem is making too many threads.
When you using Simplygon, you should managing thread count to not making too many threads.
My opinion is make thread pool and use it.
I m using 2.5.1 version of Unity plugin and 8.2.359 Simplygon Lib.
I tried to count workers
var worker = new BackgroundWorker();
workersWorking++;
and on worker.RunWorkerCompleted
worker.RunWorkerCompleted += (sender, args) =>
{
var resultMesh = (WorkingMesh)args.Result;
resultMesh.ApplyToMesh(simplifiedMesh);
simplifiedMesh.RecalculateBounds();
workersWorking--;
};.
Then I tried to check how many workers are in GenerateLODsCoroutine()
var go = menuCommand.context as GameObject;
if (go)
{
while(workersWorking > 2)
{
yield return null;
}
GenerateLODs(go);
}
However this, blocks whole Unity. Any tips how should I approach it?
You should use yield return WaitForSecond(time) insted of yield return null.
Because TimedEnumerator is not stopped until pass the iteration time. It means that yield return null is not continue next frame. It will continue same frame.
Hey, Once I select more than ~15 objects to process at once, simplygon plugin stops. Jobs are posted one by one I guess so why this happens. Any solution to automate it?