is there way to use refrence type in Entities.foreach ?

i’d like use SystremBase and BurstCompiler.
is there way to use refrence type in Entities.foreach ?

ERROR
Entities.ForEach Lambda expression uses field ‘_subscenes in a reference type’

CODE

public class SubSceneSystem : SystemBase
{
SceneSystem _sceneSystem;

protected override void OnCreate()
{
_sceneSystem = World.GetOrCreateSystem();
}

protected override void OnUpdate()
{
Entities.WithAll().ForEach((ref Translation translation) =>
{
var h =Input.GetAxis(“Horizontal”);
var v = Input.GetAxis(“Vertical”);

translation.Value.x += h;
translation.Value.z += v;

foreach (var val in SubSceneReference._instance._subscenes)
{
if(math.distance(translation.Value, val.transform.position) < 15)
_sceneSystem.UnloadScene(val.SceneGUID);
else
_sceneSystem.LoadSceneAsync(val.SceneGUID);
}
}).Run();
}
}

Only WithoutBurst, as Burst itself doesn’t support reference types

1 Like

i know brunocoimbra that is base. But I want to know if there’s another way in use burstcompiler.

Burst is not compatible with reference types, I am not aware of any workarounds for that and, if there are and isn’t present in the documentation, then it is surely not supported neither.