This would be useful in the context of deterministic simulation, since from my understanding different values of TypeIndex can lead to new entities being allocated to different chunks.
My specific use case is deterministic lockstep for multiplayer, and having one of the players as the Unity Editor during testing would be very useful to debug and investigate.
#Is it possible to have identical TypeIndex values in the Editor and a Build?
1 messages · Page 1 of 1 (latest)
TypeIndex - no, but StableTypeHash - yes
But potentially if you look into TypeManager init code, you may find a way to actually sort it's generation in some kind of way to achieve it
but most likely still no, because simply existance of Editor only component would already affect your chunk layout
(there are a bunch of components that only exist in editor)
I'm also feeling like the answer is no, but then it's quite sad if for this simple reason the Editor and Builds do not behave deterministically when it comes to choosing in what chunk to add a new entity.
It simply can not know which types are not available in build. How can it guarantee the indices of all types to be the same?
This matter is simply out of Unity's control.
But you can always build a custom type manager for your own use. You're the one know which types are available in build and editor.
It is not that I need the same TypeIndex values for my own code, I would use the StableTypeHash in that case.
But the ECS code to allocate new entities, in particular ChunkListMap, indirectly relies on TypeIndex making it behave potentially differently between Editor and Builds.
Not really sure about what a nice solution would be.