I’m seeing the following error while trying to parse some floats out of some NativeTexts I’m passing into a job via a NativeHashMap.
C:\GitLab\Unity Projects\sim-studio\SimStudio\Assets\Scripts\Simple Earth 3D\SpawnManager.cs(228,1): Burst error BC1016: The managed function `Unity.Collections.NativeText.ToString(Unity.Collections.NativeText* this)` is not supported
at SpawnManager.UpdateSatellitePositionsJob.Execute(SpawnManager.UpdateSatellitePositionsJob* this, int index, UnityEngine.Jobs.TransformAccess transform) (at C:\GitLab\Unity Projects\sim-studio\SimStudio\Assets\Scripts\Simple Earth 3D\SpawnManager.cs:228)
at UnityEngine.Jobs.IJobParallelForTransformExtensions.TransformParallelForLoopStruct`1<SpawnManager.UpdateSatellitePositionsJob>.Execute(ref SpawnManager.UpdateSatellitePositionsJob jobData, System.IntPtr jobData2, System.IntPtr bufferRangePatchData, ref Unity.Jobs.LowLevel.Unsafe.JobRanges ranges, int jobIndex)
While compiling job:
UnityEngine.Jobs.IJobParallelForTransformExtensions+TransformParallelForLoopStruct`1[[SpawnManager+UpdateSatellitePositionsJob, Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]], UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null::Execute(SpawnManager+UpdateSatellitePositionsJob&, Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null|System.IntPtr, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089|System.IntPtr, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089|Unity.Jobs.LowLevel.Unsafe.JobRanges&, UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null|System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089)
Example code of what I’m trying to do
//*** As input to a job
NativeHashMap<NativeText, NativeText> record = new NativeHashMap<NativeText, NativeText>(3, Allocator.TempJob);
record.Add(new NativeText("abc", Allocator.TempJob), new NativeText("123", Allocator.TempJob));
record.Add(new NativeText("bcd", Allocator.TempJob), new NativeText("234", Allocator.TempJob));
record.Add(new NativeText("cde", Allocator.TempJob), new NativeText("345", Allocator.TempJob));
//*** Later inside of a job that's Burst compiled
float x = float.Parse(record[new NativeText("abc", Allocator.TempJob)].ToString());
float y = float.Parse(record[new NativeText("bcd", Allocator.TempJob)].ToString());
float z = float.Parse(record[new NativeText("cde", Allocator.TempJob)].ToString());
Unity.Mathematics.float3 myVector = new Unity.Mathematics.float3(x,y,z);
Question
- Is it possible to pass a string into a burst compiled job and extract a float value from it? How?