Filter
initialization should end with aBuild()
call, for example:World.Filter.With<Component>().Build()
.ComponentProvider
has been removed. If you still need it, you may copy it from older versions, or code your own alternative.
- Tri Inspector support is now available as a free alternative to Odin Inspector integration. The framework has no paid dependencies as of now, and both Tri Inspector and Odin Inspector can be chosen by the developers.
- Added Aspects, which are represented as a helper tool combining multiple components into one structure. Read README for more details.
- Stash API now includes
stash.RemoveAll()
, which can be used to remove a certain component from all entities in one single call. Useful with OneFrame components, e.g. when you have to make sure that no entities have a specific component at an exact point of time. - Providers now have deinitialization methods the same way initialization existed.
World.JobHandle
allows combining Jobs within oneSystemsGroup
. Read README for more details.- Added profiling metrics which allow tracking entities count, archetypes count and etc. Read README for details.
- Added a flag and a method to check that the world has been removed and cannot be used anymore:
World.IsDisposed
andWorld.IsNullOrDisposed()
- Added preprocessor definition
MORPEH_DISABLE_SET_ICONS
which disables automatic icon assignment to systems, providers, etc. World.Commit()
now checks that it is not being called inside filter iterations.- Added
World.DoNotDisableSystemOnException
which prevents system from stopping on exception in debug mode. Does not affect release builds. - Added
Filter.IsNotEmpty()
.
You can continue using Odin Inspector or switch to Tri Inspector. To do this you need to add Tri Inspector via Git URL. Remove Odin, and remove Odin Inspector defines from Player Settings.
- Minimum Unity version up to 2020.3.* LTS
- Namespaces changed from
Morpeh
toScellecs.Morpeh
,Scellecs.Morpeh.Systems
,Scellecs.Morpeh.Providers
. - Globals are separated into a separate package at https://github.com/scellecs/morpeh.globals.
- The
World.UpdateFilters()
method has been renamed toWorld.Commit()
. - The
ComponentsCache<>
class has been renamed toStash<>
. All methods for stashes have lost theComponent
prefix, now justAdd, Get, Set, Has, Remove
. - Filters validate that they do not have duplicate types. For example,
Filter.With<A>().With<A>()
will throw an error. - Removed
Filter
property from systems, useWorld.Filter
instead.
- Added
ICleanupSystem
suitable for cleanup logic. Called by the most recent in LateUpdate by default. - The mechanism for cleaning components has been redesigned. Now the component must implement
IDisposable
, and it is necessary to call theAsDisposable
method of the stesh once in order for the cleanup to take place. For example, the shortest version isWorld.GetStash<T>().AsDisposable()
. - Added
World
methodGetReflectionStash
to get stash not via generic argument, but bySystem.Type
. - Added a
MORPEH_THREAD_SAFETY
define that forces the kernel to validate that all calls come from the same thread the world was created on. The binding to a thread can be changed using theWorld.GetThreadId(), World.SetThreadId()
methods. - Added API for plugins. To use it, you need to implement
IWorldPlugin
.
- Assembly definition and all links have been replaced from
XCrew.Morpeh
toScellecs.Morpeh
. Namespace is the same. - All Globals have lost method
NextFrame
. UsePublish
, which works exactly asNextFrame
used to. Current-frame Global events are not supported anymore, they are always deferred. The reason for this change is that most projects used bothPublish
+NextFrame
, orNextFrame
only. Entity.ID
is notint
anymore, butEntityID
which containsid
andgen
. This is a mandatory change for Jobs/Burst support.World.TryGetEntity(EntityId entityId, out Entity entity)
has been added, which allows checking if entity exists without storing direct reference to it.Filter.Length
is removed completely. It has been replaced withFilter.GetLengthSlow()
andFilter.IsEmpty()
. This change is made because recalculating Filter length was quite costly, and most of the time filters length was not needed for developers, making it a useless overhead. It's important to note that most length comparisons were used to check if filter is empty or not, so such checks usingIsEmpty()
are as fast as they used to be, but with a different API. This allowed us to make Morpeh much faster in projects which have a lot of different filters.- Using
entity.RemoveComponent()
clears components immediately now, and reading ref components data after removing said component is prohibited and will lead to unexpected behaviour. - Iterating
Filter
does not guarantee any order now. If your logic depended on filters returning entities exactly in specific order, it has to be fixed before upgrading. ComponentsBag
has been completely removed. It has been replaced withComponentsCache
which also provides full public access to raw components.
- Added new component interfaces
IValidatable
,IValidatableWithGameObject
. It allows calling default Unity methodOnValidate
for components, f.e. to initialize editor fields. Works only for components added via MonoProvider. - Added support for native Api (Job/Burst). Details are available in README. Most work is done via
AsNative()
for:- Archetype (NativeArchetype)
- ComponentsCache (NativeCache)
- FastList (NativeFastList)
- IntFastList (NativeIntFastList)
- Filter (NativeFilter)
- IntHashMap (NativeIntHashMap)
- World (NativeWorld)
- Added
IMorpehLogger
interface and staticMLogger
class. It allows overriding logging behaviour for Morpeh. Console.WriteLine is used for all environments by default, except Unity. - Added
MORPEH_PROFILING
define. Adding it to Player Settings allows profiling systems without using Deep Profile. Entity.Dispose()
is now public. It allows destroying entities without accessing the World it's in.- Added viewing multiple worlds in World Browser