Hi, I am following CodeMonkey’s tutorial on ECS (Unity DOTS 1.0 in 60 MINUTES! - YouTube).
About 44 mins into the video, we have a reoccurring error as we are accessing a component in read-Write reference( RefRW
) which was fetched using SystemAPI.GetSingletonRW
.
Now I know we cannot write data in threads and it is unsafe. But if we access Unity.Mathematics.Random.NextFloat(f1,f2)
, can we just use ReadOnly( RefRO
)? as the seed and value in random is updated by itself and we never have to write any value explicitly.
I tried searching SingletonRefRO
get but I only got SystemAPI.GetSingleton
and SystemAPI.GetSingletonEntity
. So I am wondering is there a way to fetch a component(RandomComponent) which has only one instance active as a RefRO and still run the application. Any suggestion or advice would be very helpful.
I know we can suppress the error, but I would like to find a different approach without suppressing the errors.