#jobs / burst
1 messages · Page 1 of 1 (latest)
interesting
The top part of the file is managed code that starts the jobs
The bottom part -- the stuff that implements IJob -- is the Bursted part
I'm trying to find the docs for this, could you send me the link?
the actual math isn't too important (it just figures out the derivative of a function that represents how desirable a point is, and moves up the gradient)
nice
This doesn't actually take advantage of parallelism. It just starts the job and then instantly completes it.
but does it start it and let the rest of the script continue while its doing the job?
yeah, thats what im looking for, to avoid freezes every time I build the nav
Here's an example of a system that does get some paralleism
It uses RaycastCommand
nice
that lets you build a huge pile of queries and then submit them to the Jobs system
interesting
although, I just realized
you were asking very specifically about nav mesh updates
I've used this before. Not for super intensive work, though
well it was specifically NavMeshSurface
so idk if this will work but i'll take a look
ah, then building it must be the bottleneck
it starts a coroutine
i'm not sure if that coroutine actually yields until the process is done
you couldn't just throw this stuff into Jobs because it interacts with Unity's data
so it has to live on the main thread
That's why you can't just slap async on a method and call it a day, to answer your earlier question :p
its just so odd bcause it was working before
maybe you're suddenly doing a lot more work
like, your voxel (i think that's the word?) size went down
public async Task BuildNav()
{
NavSurf = GetComponent<NavMeshSurface>();
await Task.Run(NavSurf.BuildNavMesh);
NavSurf.UpdateNavMesh(NavSurf.navMeshData);
//sTask.Run(NavSurf.AddData);
//BuildNav();
}
public void SpawnStuff(GameObject Struct)
{
//const int rotLen = 4;
//int* rots = stackalloc int[rotLen];
rots.Add(0);
rots.Add(90);
rots.Add(-90);
rots.Add(180);
//Place the Layout
Layout = Instantiate(Struct, transform.position + new Vector3(0, 5.8337f, 0), Quaternion.identity);
//Randomize The Layout's Rotation
Layout.transform.eulerAngles = new Vector3(0, rots[Random.Range(0, 4)], 0);
foreach (Light light in Layout.GetComponentsInChildren<Light>())
{
if(light.tag != "DontDoLightFX")
{
Lights.Add(light);
}
}
BuildNav();
// Invoke("BuildMesh", 2);
}
like this was working before
although this was a lot of little meshes and now im doing one big mesh
is baking one big mesh more intensive than baking many small ones?
certianly seems more likely to cause one big hitch