Closed jkeon closed 1 year ago
@mbaker3 Ready for re-review.
Also contains changing the name of the Task Driver System to the outside to be System
and the internal one to be TaskDriverSystem
instead of the flip-flop it was before.
All addressed. Some discussions to sort out but this is looking good!
Unity will automatically remap
Entity
references on Components and in DynamicBuffers when Entities move from one World to another.Entities that exist in
TaskDrivers
orEntityPersistentData
however will not.This PR gives functionality to provide a framework for allowing anything to be remapped and implements it for
TaskDrivers
andEntityPersistentData
What is the current behaviour?
No way to provide custom remapping.
What is the new behaviour?
Framework
Anything can implement the
IMigrationObserver
and register with theWorldEntityMigrationSystem
to receive a notification when Entities have migrated to a new World.The callback will provide the necessary information to perform the custom logic to remap Entity references.
MigrationUtil
provides the functionality to actually do the remapping viaRegisterTypeForEntityPatching
and then the call toPatchEntityReferences
.All changes to the world should happen through
WorldEntityMigrationSystem.MigrateTo
. If you use theEntityManager.MoveEntitiesFrom
vanilla function, we won't know and custom migration won't happen.TaskDrivers and EntityPersistentData
I've handled both of these systems to automatically register their types and patch references. Everything is jobified so that we can use Burst and in practice ends up being pretty quick.
Tag-Alongs
ENABLE_UNITY_COLLECTIONS_CHECKS
toANVIL_DEBUG_SAFETY
where I found them.struct
tounmanaged
GetKeyValueArrays
toEntityPersistentDataWriter
What's Next
233 There are still some ways you can miss Entities. If you have an EPD then you have a relationship of Key: Entity to Value: Something.
234 Integrity.
What issues does this resolve?
What PRs does this depend on?
Does this introduce a breaking change?
WorldEntityMigrationSystem
now instead.