Since the 0.9.0 update, I’ve got a ton of exceptions like this when I call EntityQuery.GetSingleton() in a SystemBase, in a lot of different systems.
NullReferenceException: Object reference not set to an instance of an object
Unity.Entities.EntityQuery.GetFirstArchetypeIndexWithEntity (System.Int32& entityCount) (at Library/PackageCache/com.unity.entities@0.9.0-preview.6/Unity.Entities/Iterators/EntityQuery.cs:868)
It doesn’t happen 100%, but quite often anyway. Anybody else got those?
I do get the exceptions too, hence I downgraded back to 0.8.0 for now. I don’t know if it’s expected behaviour or if it’s a bug on their side, and documentation is non existent for 0.9.0 unfortunately.
Improved performance of access to singletons through SetSingleton and GetSingleton in SystemBase (peformance is also improved through these methods on EntityQuery).
Looks like something must of broke during that optimization.
public void GetCreatedAndDestroyedEntitiesAsync(NativeList state, NativeList createdEntities, NativeList destroyedEntities) detects which entities were created and destroyed since the last call to this method.
Added the ability to reimport a SubScene via an inspector button, which forces reconversion.
Added GameObjectConversionSystem.DeclareAssetDependency which expresses that the conversion result of a GameObject depends on an Asset
Added void EntityManager.Instantiate(NativeArray srcEntities, NativeArray dstEntities). It gives explicit control over the set of entities that are instantiated as a set. Entity references on components that are cloned to entities inside the set are remapped to the instantiated entities.
Added void EntityManager.CopyEntitiesFrom(EntityManager srcEntityManager, NativeArray srcEntities, NativeArray outputEntities = default). It lets you copy a specific set of entities from one World to another. Entity references on components that are cloned to entities inside the set are remapped to the instantiated entities.
Added assembly for Mesh Deformation data structures.
Changed
Systems are now constructed in two phases. First, ECS creates a new instance of all systems and invokes the constructor. Then, it invokes all OnCreatemethods. This way, you can now use World.GetExistingSystem() from inside OnCreate().
Systems are now destroyed in three phases. First, ECS stops all running systems (i.e. OnStopRunning() is invoked). Then it invokes all OnDestroymethods. Finally, ECS destroys all systems. This means you can perform safe and predictable cleanup of systems with cross-references to other systems.
EntityCommandBuffer Playback now Bursted through function pointers. When there’s a mix of unmanaged and managed commands in a single buffer, unmanaged commands will be Bursted. When there are no managed commands, each chain’s Playback is fully Bursted.
Entities.ForEach in a GameObjectConversionSystem no longer logs a warning if there are multiples of a queried authoring component on a matching GameObject. It now returns the first component instance of the desired type, so conversion systems can optionally call GetComponents() in order to handle multiples if desired.
Declaring a non-Prefab object as a referenced Prefab during conversion now emits a warning
Improved performance of access to singletons through SetSingleton and GetSingleton in SystemBase (peformance is also improved through these methods on EntityQuery).
Updated package com.unity.properties to version 1.1.0-preview.
Updated package com.unity.serialization to version 1.1.0-preview.
Updated package com.unity.platforms to version 0.2.2-preview.7.
Deprecated
Deprecated public T World.CreateSystem(params object[ ] constructorArguments). Please use World.AddSystem(new MySystem(myParams)); instead.
My apologies. This has already been fixed in Entities but the fix did not make it into this latest release. We’ll try to publish a new version of the package with the fix ASAP.