diff --git a/CHANGELOG.md b/CHANGELOG.md index 057879987d..ab0c642d88 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ - The GDK now depends on .NET Core v3.1.3xx instead of v2.2.2xx. [#1443](https://github.com/spatialos/gdk-for-unity/pull/1443) - Removed APIs for AuthorityLossImminent. [#1451](https://github.com/spatialos/gdk-for-unity/pull/1451) - All authority changes to `AuthorityLossImminent` will now be dropped, and callbacks will no longer trigger. +- Removed the `AuthoritativeEntityResolver`. The implementation was fundamentally flawed. [#1453](https://github.com/spatialos/gdk-for-unity/pull/1453) ### Added diff --git a/UPGRADE_GUIDE.md b/UPGRADE_GUIDE.md index 39d21b39dd..728eef0052 100644 --- a/UPGRADE_GUIDE.md +++ b/UPGRADE_GUIDE.md @@ -25,10 +25,26 @@ The `Reader` and `Writer` classes have had their `public Authority Authority` pr ### .NET Core Update -The GDK, in particular the code generator and deployment launcher, has been updated to use [.NET Core SDK v3.1.3xx](https://dotnet.microsoft.com/download/dotnet-core/3.1). +The GDK, in particular the code generator and deployment launcher, has been updated to use [.NET Core SDK v3.1.3xx](https://dotnet.microsoft.com/download/dotnet-core/3.1). To update, download and install the new version from the link provided above. +### `AuthoritativeEntityResolver` removal + +We removed the `AuthoritativeEntityResolver` as the implementation was fundamentally flawed. Depending on how you were using it, there are different replacements: + +#### For your player entity + +Use the `OwningWorkerEntityResolver` which uses the `OwningWorker` component from the Player Lifecycle Feature Module. Make sure that when you create your player's `EntityTemplate` you add the relevant components with: + +```csharp +PlayerLifecycleHelper.AddPlayerLifecycleComponents(EntityTemplate template, clientWorkerId, serverAccess); +``` + +#### For server authoritative entities + +If you were using this resolver on the server, we recommend merging the two Prefabs into one and rely on the GDK enabling/disabling behaviours when they are active or not. + ## From `0.3.7` to `0.3.8` ### Asset based entity representation @@ -69,7 +85,7 @@ The Scripting Backend defined in the Unity Project Settings is now overwritten b In [#1376](https://github.com/spatialos/gdk-for-unity/pull/1376), some generated code has changed locations in your project. If you are ignoring these files in your `.gitignore`, you will want to add two new entries: -Before: +Before: ``` Assets/Generated/Source.meta diff --git a/workers/unity/Packages/io.improbable.gdk.core/Representation/Types/AuthoritativeEntityResolver.cs b/workers/unity/Packages/io.improbable.gdk.core/Representation/Types/AuthoritativeEntityResolver.cs deleted file mode 100644 index 9e9067ab84..0000000000 --- a/workers/unity/Packages/io.improbable.gdk.core/Representation/Types/AuthoritativeEntityResolver.cs +++ /dev/null @@ -1,37 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using Unity.Entities; -using UnityEngine; - -namespace Improbable.Gdk.Core.Representation.Types -{ - [Serializable] - public class AuthoritativeEntityResolver : IEntityRepresentationResolver - { - public string EntityType => entityType; - public IEnumerable RequiredComponents => requiredComponents.Append(authComponentId); - -#pragma warning disable 649 - [SerializeField] private string entityType; - [SerializeField] private GameObject ownedPrefab; - [SerializeField] private GameObject unownedPrefab; - [SerializeField] private uint authComponentId; - [SerializeField] private uint[] requiredComponents = { }; -#pragma warning restore 649 - - public GameObject Resolve(SpatialOSEntityInfo entityInfo, EntityManager manager) - { - var authComponent = ComponentDatabase.GetMetaclass(authComponentId).Authority; - return manager.HasComponent(entityInfo.Entity, authComponent) - ? ownedPrefab - : unownedPrefab; - } - - public void DeclareReferencedPrefabs(List referencedPrefabs) - { - referencedPrefabs.Add(ownedPrefab); - referencedPrefabs.Add(unownedPrefab); - } - } -} diff --git a/workers/unity/Packages/io.improbable.gdk.core/Representation/Types/AuthoritativeEntityResolver.cs.meta b/workers/unity/Packages/io.improbable.gdk.core/Representation/Types/AuthoritativeEntityResolver.cs.meta deleted file mode 100644 index 24a47b0421..0000000000 --- a/workers/unity/Packages/io.improbable.gdk.core/Representation/Types/AuthoritativeEntityResolver.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 87830c8d74314007815a7ec480991479 -timeCreated: 1590577562 \ No newline at end of file