All sorts of issues with the 0.2.0 preview packages. Were they supposed to be visible in the package manager?
What kinds of issues? I have no issues so far (Unity 2020.1.a14).
Had issues as well. For some reason the dependency
âcom.unity.collectionsâ: â0.2.0-preview.13â
in the jobs package was not auto resolving. Once that was manually updated my issues disappeared.
For me itâs
Library\PackageCache\com.unity.entities@0.2.0-preview.18\Unity.Scenes.Editor\SubSceneImporter.cs(30,104): error CS0234: The type or namespace name 'CalculateCustomDependencyData' does not exist in the namespace 'UnityEditor.Build.Pipeline.Tasks' (are you missing an assembly reference?)
With Scriptable Build pipeline 1.5.4
EDIT : Entities 0.2 needs version 1.6.3 of scriptable build pipeline
Installing Collections on itâs own fails, it works once you install entities.
Hybrid Renderer multiple compiler errors.
It all looks to be very fragile based on what exactly you have installed per package.
World.Active deprecated and behavior changed.
The replacement, DefaultGameObjectInjectionWorld, is now null during custom bootstrap as it now runs before the default world is created. hmmm.
Change log
[0.2.0] - 2019-11-22
This version requires Unity 2019.3 0b11+
New Features
-
Automatically generate authoring components for IComponentData with IL post-processing. Any component data marked with a GenerateAuthoringComponent attribute will generate the corresponding authoring MonoBehaviour with a Convert method.
-
BuildSettings assets are now used to define a single build recipe asset on disk. This gives full control over the build pipeline in a modular way from C# code.
-
BuildSettings let you attach builtin or your own custom IBuildSettingsComponents for full configurability
-
BuildPipelines let you define the exact IBuildStep that should be run and in which order
-
IBuildStep is either builtin or your own custom build step
-
BuildSettings files can be inherited so you can easily make base build settings with most configuration complete and then do minor adjustments per build setting
-
Right now most player configuration is still in the existing PlayerSettings, our plan is to over time expose all Player Settings via BuildSettings as well to ease configuration of complex projects with many build recipes & artifacts
-
SubScenes are now automatically converted to entity binary files & cached by the asset pipeline. The entity cache files previously present in the project folder should be removed. Conversion systems can use the ConverterVersion attribute to convert to trigger a reconversion if the conversion system has changed behaviour. The conversion happens asynchronously in another process. Thus on first open the subscenes might not show up immediately.
-
Live link builds can be built with the new BuildSettings pipeline.
Open sub scene -
Closed Entity scenes are built by the asset pipeline and loaded via livelink on demand
-
Opened Entity scenes are send via live entity patcher with patches on a per component / entity basis based on what has changed
-
Assets referenced by entity scenes are transferred via livelink when saving the asset
-
Scenes loaded as game objects are currently not live linked (This is in progress)
by assigning the LiveLink build pipeline -
Entities.ForEachsyntax for supplying jobified code in aJobComponentSystemâsOnUpdatemethod directly by using a lambda (instead of supplying an additionalIJobForEach). -
EntityQueryMaskhas been added, which allows for quick confirmation of if an Entity would be returned by anEntityQuerywithout filters viaEntityQueryMask.Matches(Entity entity). An EntityQueryMask can be obtained by callingEntityManager.GetEntityQueryMask(EntityQuery query). -
Unity Entities now supports the Fast Enter playmode which can be enabled in the project settings. It is recommended to be turned on for all dots projects.
-
The UnityEngine component
StopConvertToEntitycan be used to interruptConvertToEntityrecursion, and should be preferred over aConvertToEntityset to âconvert and injectâ for that purpose. -
EntityDebugger now shows IDs in a separate column, so you can still see them when entities have custom names
-
Entity references in the Entity Inspector have a âShowâ button which will select the referenced Entity in the Debugger.
-
An
ArchetypeChunkIteratorcan be created by callingGetArchetypeChunkIteratoron anEntityQuery. You may run anIJobChunkwhile bypassing the Jobs API by passing anArchetypeChunkIteratorintoIJobChunk.RunWithoutJobs(). -
The
[AlwaysSynchronizeSystem]attribute has been added, which can be applied to aJobComponentSystemto force it to synchronize on all of its dependencies before every update. -
BoneIndexOffsethas been added, which allows the Animation system to communicate a bone index offset to the Hybrid Renderer. -
Initial support for using Hybrid Components during conversion, see the HybridComponent sample in the StressTests folder.
-
New
GameObjectConversionSystem.ForkSettings()that provides a very specialized method for creating a fork of the current conversion settings with a different âEntityGuid namespaceâ, which can be used for nested conversions. This is useful for example in net code where multiple root-level variants of the same authoring object need to be created in the destination world. -
EntityManagerLockChunkOrderandUnlockChunkOrderare deprecated. -
Entity Scenes can be loaded synchronously (during the next streaming system update) by using
SceneLoadFlags.BlockOnStreamIninSceneSystem.LoadParameters. -
EntityCommandBuffercan now be played back on anExclusiveEntityTransactionas well as anEntityManager. This allows ECB playback to be invoked from a job (though exclusive access to the EntityManager data is still required for the duration of playback).
Upgrade guide
- If you are using SubScenes you must use the new BuildSettings assets to make a build & run it. SubScenes are not supported from the File â BuildSettings⌠& File â Build and Run workflows.
- Entities requires AssetDatabase V2 for certain new features, we do not provide support for AssetDatabase V1.
Fixes
- Setting
ComponentSystemGroup.Enabledtofalsenow callsOnStopRunning()recursively on the groupâs member systems, not just on the group itself. - Updated Properties pacakge to
0.10.3-previewto fix an exception when showing Physics ComponentData in the inspector as well as fix IL2CPP Ahead of Time linker errors for generic virtual function calls. - The
LocalToParentSystemwill no longer write to theLocalToWorldcomponent of entities that have a component with theWriteGroup(typeof(LocalToWorld)). - Entity Debugger styling work better with Pro theme
- Entity Inspector no longer has runaway indentation
- Fixed issue where
AddSharedComponentData,SetSharedComponentDatadid not always updateSharedComponentOrderVersion. - Fixes serialization issue when reading in managed
IComponentDatacontaining array types andUnityEngine.Objectreferences. - No exception is thrown when re-adding a tag component with
EntityQuery. AddComponent<T>(NativeArray<Entity>)now reliably throws anArgumentExceptionif any of the target entities are invalid.- Fixed an issue where the Entity Debugger would not repaint in edit mode
- Marking a system as
[UpdateInGroup(typeof(LateSimulationSystemGroup))]no longer emits a warning about[DisableAutoCreation]. - Fixed rendering of chunk info to be compatible with HDRP
- Fixed issue where
ToComponentDataArrayignored the filter settings on theEntityQueryfor managed component types.
Changes
- Moved
NativeStringcode from Unity.Entities to Unity.Collections. - Updated dependencies for this package.
- Significantly improved
Entityinstantiation performance when running in-Editor. - Added support for managed
IComponentDatatypes such asclass MyComponent : IComponentData {}which allows managed types such as GameObjects or List<>s to be stored in components. Users should use managed components sparingly in production code when possible as these components cannot be used by the Job System or archetype chunk storage and thus will be significantly slower to work with. Refer to the documentation for component data for more details on managed component use, implications and prevention. - âSubSceneStreamingSystemâ has been renamed to
SceneSectionStreamingSystemand is now internal - Deprecated
_SceneEntitiesinSubScene.cs. Please useSceneSystem.LoadAsync/Unloadwith the respective SceneGUID instead. This API will be removed after 2019-11-22. - Updated
com.unity.serializationto0.6.3-preview. - The deprecated
GetComponentGroup()APIs are nowprotectedand can only be called from inside a System like theirGetEntityQuery()successors. - All GameObjects with a ConvertToEntity set to âConvert and Destroyâ will all be processed within the same conversion pass, this allows cross-referencing.
- Duplicate component adds are always ignored
- When adding component to single entity via EntityQuery, entity is moved to matching chunk instead of chunk achetype changing.
- âUsed by Systemsâ list skips queries with filters
- Managed
IComponentDatano longer require all fields to be non-null after default construction. ISharedComponentDatais serialized inline with entity and managedIComponentData. If a shared component references aUnityEngine.Objecttype, that type is serialized separately in an âobjrefsâ resource asset.EntityManagercallsEntityComponentStorevia burst delegates forAdd/Removecomponents.EntityComponentStorecannot throw exceptions (since called as burst delegate from main thread.)bool ICustomBootstrap.Initialize(string defaultWorldName)has changed API with no deprecated fallback. It now simply gives you a chance to completely replace the default world initialization by returning true.ICustomBootstrap&DefaultWorldInitializationis now composable like this:
class MyCustomBootStrap : ICustomBootstrap
{
public bool Initialize(string defaultWorldName)
{
Debug.Log("Executing bootstrap");
var world = new World("Custom world");
World.DefaultGameObjectInjectionWorld = world;
var systems = DefaultWorldInitialization.GetAllSystems(WorldSystemFilterFlags.Default);
DefaultWorldInitialization.AddSystemsToRootLevelSystemGroups(world, systems);
ScriptBehaviourUpdateOrder.UpdatePlayerLoop(world);
return true;
}
}
ICustomBootstrapcan now be inherited and only the most deepest subclass bootstrap will be executed.DefaultWorldInitialization.GetAllSystemsis not affected by bootstrap, it simply returns a list of systems based on the present dlls & attributes.Timeis now available per-World, and is a property in aComponentSystem. It is updated from theUnityEngine.Timeduring theInitializationSystemGroupof each world. If you need access to time in a sytem that runs in theInitializationSystemGroup, make sure you schedule your system afterUpdateWorldTimeSystem.Timeis also a limitedTimeDatastruct; if you need access to any of the extended fields available inUnityEngine.Time, accessUnityEngine.Timeexplicitly`- Systems are no longer removed from a
ComponentSystemGroupif they throw an exception from theirOnUpdate. This behavior was more confusing than helpful. - Managed IComponentData no longer require implementing the
IEquatable<>interface and overridingGetHashCode(). If either function is provided it will be preferred, otherwise the component will be inspected generically for equality. EntityGuidis now constructed from an originating ID, a namespace ID, and a serial, which can be safely extracted from their packed form using new getters. Useaandbfields when wanting to treat this as an opaque struct (the packing may change again in the future, as there are still unused bits remaining). The a/b constructor has been removed, to avoid any ambiguity.- Updated
com.unity.platformsto0.1.6-preview. - The default Api Compatibility Level should now be
.NET Standard 2.0and a warning is generated when the project uses.NET 4.x. - Added
[UnityEngine.ExecuteAlways]toLateSimulationSystemGroup, so its systems run in Edit Mode.
Known Issues
I like the deprecation notes on World.Active, rare cases where you might need to access it outside of a system. Ya ok.
Convert and inject is just completely broken (at least in root objects)
After looking at new conversion sourceâŚ
// All entities to be converted are marked to be destroyed
foreach (var convert in toBeConverted)
toBeDestroyed.Add(convert.gameObject);
// Conversion happens
foreach (var convert in toBeConverted)
AddRecurse(gameObjectWorld.EntityManager, convert.transform, toBeDetached, toBeInjected);
GameObjectConversionUtility.Convert(gameObjectWorld);
// Then injection happens
var mappingSystem = gameObjectWorld.GetExistingSystem<GameObjectConversionMappingSystem>();
foreach (var convert in toBeInjected)
InjectOriginalComponents(mappingSystem, convert);
// ...
// And then all the gameobjects are destroyed, even the injected objects
foreach (var go in toBeDestroyed)
UnityObject.DestroyImmediate(go);
So now you have a bunch of destroyed components/gameobjects attached to your entityâŚ
-edit-
yeah, simply adding an empty GO with convert entity script and attach your objects you want to use inject with as children then it works fine.
just root objects which are broken.
Iâm seeing play mode just freeze up for like 10 seconds soon after it starts. Something in the new packages but unsure as to how to profile whatâs going on. I canât start the profiler with play mode if Unity is frozen. Unless there is some way I donât know of it make the profiler start profiling play mode before I enter play mode?
With or without domain reloading enabled?
Mine feels pretty snappy, near instant with domain reloading off now that I have it all updated.
One thing to note is conversion seems to have moved to the actual update loop in initialization.
Built out players with Burst AOT disabled throw an exception upon start.
'Message': 'Burst failed to compile the function pointer `Void AddComponentEntitiesBatchExecute(Unity.Entities.EntityComponentStore*, Unity.Collections.LowLevel.Unsafe.UnsafeList*, Int32)`'
'Stacktrace': ' at Unity.Burst.BurstCompiler.Compile[T] (T delegateObj, System.Boolean isFunctionPointer) [0x000f3] in <3e635592c8244e9c835505c46070ed2f>:0
at Unity.Burst.BurstCompiler.CompileFunctionPointer[T] (T delegateMethod) [0x00000] in <3e635592c8244e9c835505c46070ed2f>:0
at Unity.Entities.StructuralChange.Initialize () [0x00000] in <71559f61f83b471ca031f77599b51d27>:0
at Unity.Entities.EntityManager..ctor (Unity.Entities.World world) [0x0000b] in <71559f61f83b471ca031f77599b51d27>:0
So interestingly, while I have everything running on 0.2 with the latest burst package, not a single job is running bursted.
The jobs compile fine. Synchronous compilation takes takes a while as expected and burst inspector shows the compiled jobs however performance is abysmal and the profiler shows no jobs, my own or unitys (physics, transform, hybrid renderer) as running burst compiled.
While I did not update Burst (already had latest), going to give a library rebuild a shot see if it helps.
Ah that sounds like why our main scene is freezing up. We do some pretty heavy burst jobs on scene load several seconds bursted before it stabilizes. Without burst we are fubar.
And that was actually my first thought, I tried downgrading burst but entities relies on the latest. So for now just downgrading it all.
Deleting my Library folder and re-importing everything has fixed the burst compiler, however some of my jobs are performing much worse than before.
1 in particular is taking about twice as long to execute, however this is actually using a custom job type so Iâm going to investigate if something has changed with jobs.
-edit-
turning off safety checks somewhat fixed performance issues, though still feels a little slower from memory but I donât have hard numbers in front of me. Not sure what checks have changed as it definitely wasnât this expensive as it was causing this particular job on my stress test to go from 7-8ms to 20-22ms when checks are enabled.
everything seems /ok/ for now. up and running
now to update hybrid render and to see what is up
âversionâ: â0.2.0-preview.18â
Goodbye lights
Hello SkinnedMeshRenderer conversion
EntityManagerLockChunkOrderandUnlockChunkOrderare deprecated.
What? EntityManager is deprecated? And replaced by what?
DefaultGameObjectInjectionWorld. Really bad idea. Not how to solve the problem.
It refers to EntityManager is not deprecated. Just those two methods in it.