#Running Job Progress

1 messages · Page 1 of 1 (latest)

gleaming remnant
#

Is there anyway for me to get the progress of a long running job that I have scheduled off the main thread?

I know Unity doesn't have any provided way, I just want to know if it is possible at all.

As far as I know you are not allowed to access any data from a Job until that Job is complete.

limber radish
#

If you turn off safety you could read a counter

#

You don't really care about the timing and safety

gleaming remnant
#

Cool. I should learn more about all the benefits to turning off safety. Seems a lot of good stuff can come from it if you're careful.

#

Can you turn it off on a job by job basis, or do you have to turn all of it off?

limber radish
#

there are attributes to turn it off per container

celest venture
#

Basically just pass in a float array of length 1 and attribute it with [NativeDisableContainerSafetyRestriction]
Then you can update the float whenever you want inside it and just read off it for progress.
Just be aware that if you want to write to it in parallel you'll need to use atomic operations or mutexes

gleaming remnant
#

Sick, thanks

limber radish
#

(NativeReference is a tiny bit cleaner)

gleaming remnant
#

NativeReference in replacement of...a float array of length 1?

lean pilot
#

It's in essence an array of length 1