com.unity.properties 2.0.0-exp.13
Notes: processedReleased June 15, 2022
Unity Compatibility
Minimum Unity: 2021.3 (0f1)
Package Dependencies
📈 Improvements
- Updated minimum Unity version to `2021.3`.
- Updated `com.unity.test-framework.performance` to version `2.8.0`.
- Removed dependency on `com.unity.nuget.mono-cecil`.
- Changed the property bag generation from IL Post Processors to Source Generators. Assemblies now have to opt-in code generation by tagging the assembly with the `[GeneraPropertyBagsForAssembly]` attribute.
- ***Breaking change*** `PropertyBag` and `Property` have been refactored for consistency and to provide more extensibility.
- - `IPropertyBag.GetProperties` now returns a `PropertyCollection` instead of an `IEnumerable>`. The `PropertyCollection` struct can be used to enumerate properties with no allocations in common cases.
- - Added a `IPropertyBag.GetProperties` overload that does not require an instance. This overload can only support cached properties.
- - Added `PropertyBag.GetPropertyBag(Type)` and `PropertyBag.GetPropertyBag()` API methods.
- - Added a `PropertyBag.Exists` method for checking if a property bag exists for a given type.
- - Added a `PropertyBag.CreateInstance` method which allows type construction through an explicit delegate, property bag implementation or activator.
- - `IProperty.TrySetValue` has been renamed to `IProperty.SetValue`.
- - `IProperty.Visit(PropertyVisitor, TValue)` has been removed. Use `PropertyContainer.Accept(IPropertyBagVisitor, TContainer)` instead.
- ***Breaking change*** Visitors have been refactored for consistency and to provide more extensibility.
- - Added all visitor interfaces to the public API (`IPropertyBagVisitor`, `IPropertyVisitor` etc). These can be used to write lower level and more specialized visitors.
- - Added a `PropertyBag.AccepWithSpecializedVisitor` helper method to dispatch to the correct visitation overload.
- - Visitation adapters (`IExclude` and `IVisit`) now pass a context object (respectively `ExcludeContext` and `VisitContext`) instead of the `IProperty`.
- - `Unity.Properties.VisitStatus` has been removed. Visitation adapters now requires an explicit call to `ContinueVisitation` (equivalent of `VisitStatus.Unhandled`) or `ContinueVisitationWithoutAdapters` (equivalent of `VisitStatus.Handled`) in order continue visitation.
- ***Breaking change*** The `PropertyContainer` has been refactored to increase consistency and user-friendliness.
- - `PropertyContainer.Visit` has been renamed to `PropertyContainer.Accept` and the parameter order has changed.
- - Added a `PropertyContainer.TryAccept` overload taking a `PropertyPath`.
- - Added a `PropertyContainer.IsPathValid` overload taking a `string`.
- - Added a `VisitParameters` parameter to all `PropertyContainer.Accept` overloads.
- - `PropertyContainer.GetProperty(ref object, PropertyPath)` and `PropertyContainer.TryGetProperty(ref object, PropertyPath)` have been removed. The generic overload should now be used.
- - `PropertyContainer.GetValue(ref object, string)`, `PropertyContainer.GetValue(ref object, PropertyPath)`, `PropertyContainer.TryGetValue(ref object, string, out T)` and `PropertyContainer.TryGetValue(ref object, PropertyPath, out T)` have been removed. The generic overload should now be used.
- - `PropertyContainer.SetValue(ref object, string)`, `PropertyContainer.SetValue(ref object, PropertyPath, T)`, `PropertyContainer.TrySetValue(ref object, string, T)` and `PropertyContainer.TrySetValue(ref object, PropertyPath, T)` have been removed. The generic overload should now be used.
- - `PropertyContainer.IsPathValid(ref object, PropertyPath)` has been removed. The generic overload should now be used.
- - Fixed `PropertyContainer.IsPathValid` throwing an exception when a `null` value is visited on the given path.
- - `VisitExceptionType` has been renamed to `VisitExceptionKind`
- - `VisitErrorCode` has been renamed to `VisitReturnCode`.
- ***Breaking change*** `TypeConversion` has been refactored to avoid stack overflows when trying to convert very large structs.
- - `TypeConversion.Convert` and `TypeConversion.TryConvert` methods must now pass the source parameter as a `ref`.
- - `TypeConversion.ConvertDelegate` has been renamed to `TypeConversion.TypeConverter` now passes the source parameters by `ref`.
- - `TypeConversion` primitive converters now perform a direct C# cast instead of clamping.
- ***Breaking change*** `PropertyPath` was heavily refactored and is now an immutable struct.
- - `PropertyPath.PartsCount` has been renamed to `PropertyPath.Length`.
- - `PropertyPath.Empty` has been renamed to `PropertyPath.IsEmpty`.
- - `PropertyPath.PopPart` has been renamed to `PropertyPath.Pop` and was changed from an instance method to a static method.
- - `PropertyPath.AppendPath` overloads has been renamed to `PropertyPath.Combine` and were changed from instance to static methods.
- - `PropertyPath.AppendPart`, `PropertyPath.AppendName`, `PropertyPath.AppendIndex`, `PropertyPath.AppendKey` and `PropertyPath.AppendProperty` were changed from instance to static methods.
- - `PropertyPath.Part` has been renamed to `PropertyPathPart`.
- - `PropertyPath.PartType` has been renamed to `PropertyPathPartKind`.
- ***Breaking change*** `TypeConstruction` has been merged into `Unity.Properties.TypeUtility` and is now partly available at runtime.
- - `TypeConstruction.UnsetExplicitConstructionMethod` and `TypeConstruction.TryUnsetExplicitConstructionMethod` has been removed.
- - `GetAllConstructableTypes` has been removed. It is now available through the `com.unity.properties.ui` package.
- - `CanBeConstructedFromDerivedType` has been removed. It is now available through the `com.unity.properties.ui` package.
- - Fixed type conversion issues for `Nullable` types.
- ***Breaking change*** `TypeUtility` has been moved from `Unity.Properties.Editor` to `Unity.Properties` and is now available at runtime.
- ***Breaking change*** The `GeneratePropertyBagsInEditorAttribute` has been removed.
- ***Breaking change*** The `AOT` helpers have been removed in Unity 2022.1 and newer versions.
✨ Features
- Added a `PathVisitor` base class allowing to run the visitor at a specific `PropertyPath`.
- Added a `ConcreteTypeVisitor` base class allowing to receive a strongly-typed callback for a given container instance.
- Added a `TypeTraits` utility class.
⚡ API Changes
- Removed the global conversion between `Vector2` and `vector2Int`.
- Removed the global conversion between `Vector3` and `vector3Int`.
- Removed the `AnimationCurve` and `KeyFrame` types from the default property bags.
- Removed internal usage of the `UNITY_DOTSRUNTIME` define.
🔧 Bug Fixes
- Fixed an issue where converting from `object` to a `UnityEngine.Object` would cause a stack overflow.
