How to perform Raycast inside IJobParallelFor ?
I'm testing Unity.Jobs and I'm trying to perform Raycast inside the IJobParallelFor.Execute function. When I tried to call the Raycast API inside the Execute function I got this error. "UnityException: INTERNAL_CALL_Internal_RaycastTest can only be called from the main thread."
During this presentation Unite Austin 2017 - Massive Battle in the Spellsouls Universe, they mentioned a new "batched raycasts" Api, but I can't find it in the documentation. if anyone got an idea or an example please let me know. Thanks
Answer by timjohansson · Feb 02, 2018 at 02:07 PM
The documentation for the batched raycasts is at https://docs.unity3d.com/2018.1/Documentation/ScriptReference/RaycastCommand.html .
You cannot call it from within an IJobParallelFor, you need to schedule the batch from the main thread and setup dependency chains if you want to prepare the commands or process the results in jobs.
How to setup dependency chains? I want to process the results in jobs! Thnaks
Your answer
Follow this Question
Related Questions
I can't get RayCast to report the collider I want. 1 Answer
Blink, Dash, Raycasting 0 Answers
More advanced Top down enemy AI 0 Answers
Child game-object moving faster than parent game-object 0 Answers
Spawning objects uNet Client and Local 0 Answers