diff --git a/.gitignore b/.gitignore index 96b4bedcd..7af311d09 100644 --- a/.gitignore +++ b/.gitignore @@ -1,23 +1,17 @@ /build -/workers/unity/build/ /logs/ .spatialos/ .idea/ .vs/ +.gradle/ .DS_Store DevAuthToken.txt* #Unity Engine Gitignore (https://github.com/github/gitignore/blob/master/Unity.gitignore) -workers/unity/[Ll]ibrary/ -workers/unity/[Tt]emp/ -workers/unity/Logs/ [Oo]bj/ [Bb]in/ -workers/unity/ProjectSettings/UnityConnectSettings.asset # Autogenerated VS/MD/Consulo solution and project files -workers/unity/*.csproj -workers/unity/*.sln *.unityproj *.suo *.tmp @@ -33,21 +27,9 @@ sysinfo.txt # Builds *.apk *.unitypackage +*.trace -# Generated code -# We need to include some of the generated code below, which means we can't use a `directory/` ignore. -# Once a directory is ignored by git, nothing underneath it can ever be un-ignored. -workers/unity/Assets/Generated/Source.meta -workers/unity/Assets/Generated/Source/**/*.* - -workers/unity/Assets/Plugins/Editor/ -workers/unity/Assets/Plugins/Editor.meta - -workers/unity/Assets/Plugins/Improbable/ -workers/unity/Assets/Plugins/Improbable.meta - -# Schema from Unity Package Manager Packages (Copied via tools/CopySchema) -schema/from_gdk_packages _ReSharper.Caches .shared-ci/ +perftest-results/ diff --git a/CHANGELOG.md b/CHANGELOG.md index 3b8fcdfe2..c9f90ea4a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,11 +2,22 @@ ## Unreleased +### Breaking Changes + +- Moved the `BlankProject` assembly definition from `Assets` to `Assets/BlankProject` to avoid common compile issues with Plugins. [#111](https://github.com/spatialos/gdk-for-unity-blank-project/pull/111) + +### Added + +- Enabled GameObject Creation by default using the new Entity Representation assets. [#111](https://github.com/spatialos/gdk-for-unity-blank-project/pull/111) + - The prefab mapping assets can be found in `Assets/Config`. + - Prefabs no longer need to be stored in `Resources`. + ## `0.3.7` - 2020-06-22 ### Changed - Upgraded to GDK for Unity version `0.3.7` + ### Removed - Removed the `com.unity.xr.legacyinputhelpers` package from the `manifest.json`. [#107](https://github.com/spatialos/gdk-for-unity-blank-project/pull/107) @@ -51,11 +62,13 @@ ### Changed - Upgraded to GDK for Unity version `0.3.2` + ## `0.3.1` - 2019-11-25 ### Changed - Upgraded to GDK for Unity version `0.3.1` + ## `0.3.0` - 2019-11-11 ### Changed diff --git a/gdk.pinned b/gdk.pinned index 520c96c6d..48baeb9db 100644 --- a/gdk.pinned +++ b/gdk.pinned @@ -1 +1 @@ -develop 46be8d892f3d1a1ddd62d202200c0c227a02ca4a \ No newline at end of file +develop da81d115c675dc6e2ad1226a149740974a260ba6 diff --git a/workers/unity/.gitignore b/workers/unity/.gitignore new file mode 100644 index 000000000..749c25555 --- /dev/null +++ b/workers/unity/.gitignore @@ -0,0 +1,25 @@ +# Unity generated files +/UIElementsSchema +/[Ll]ibrary/ +/[Tt]emp/ +/Logs/ +/ProjectSettings/UnityConnectSettings.asset +/*.csproj +/*.sln + +# Build artifacts +/build/ + +# SpatialOS Generated Files +/Assets/Generated/Source.meta +/Assets/Generated/Source/**/*.* +/Assets/Generated/Editor.meta +/Assets/Generated/Editor/**/*.* + +# OLD Plugins folder +/Assets/Plugins/Improbable/ +/Assets/Plugins/Improbable.meta + +# Jetbrains +/Assets/Plugins/Editor/Jetbrains +/Assets/Plugins/Editor/Jetbrains.meta diff --git a/workers/unity/Assets/BlankProject.asmdef b/workers/unity/Assets/BlankProject/BlankProject.asmdef similarity index 84% rename from workers/unity/Assets/BlankProject.asmdef rename to workers/unity/Assets/BlankProject/BlankProject.asmdef index 88ac5776b..25b2b375c 100644 --- a/workers/unity/Assets/BlankProject.asmdef +++ b/workers/unity/Assets/BlankProject/BlankProject.asmdef @@ -6,6 +6,7 @@ "Improbable.Gdk.Mobile", "Improbable.Gdk.PlayerLifecycle", "Improbable.Gdk.QueryBasedInterestHelper", + "Improbable.Gdk.GameObjectCreation", "Unity.Entities", "Unity.Entities.Hybrid", "Unity.Mathematics" @@ -17,5 +18,6 @@ "precompiledReferences": [], "autoReferenced": true, "defineConstraints": [], - "versionDefines": [] -} + "versionDefines": [], + "noEngineReferences": false +} \ No newline at end of file diff --git a/workers/unity/Assets/BlankProject.asmdef.meta b/workers/unity/Assets/BlankProject/BlankProject.asmdef.meta similarity index 100% rename from workers/unity/Assets/BlankProject.asmdef.meta rename to workers/unity/Assets/BlankProject/BlankProject.asmdef.meta diff --git a/workers/unity/Assets/BlankProject/Scripts/Workers/MobileClientWorkerConnector.cs b/workers/unity/Assets/BlankProject/Scripts/Workers/MobileClientWorkerConnector.cs index 165b662cd..12aff51f5 100644 --- a/workers/unity/Assets/BlankProject/Scripts/Workers/MobileClientWorkerConnector.cs +++ b/workers/unity/Assets/BlankProject/Scripts/Workers/MobileClientWorkerConnector.cs @@ -1,5 +1,7 @@ using System; using Improbable.Gdk.Core; +using Improbable.Gdk.Core.Representation; +using Improbable.Gdk.GameObjectCreation; using Improbable.Gdk.Mobile; using Improbable.Gdk.PlayerLifecycle; using UnityEngine; @@ -8,6 +10,8 @@ namespace BlankProject { public class MobileClientWorkerConnector : WorkerConnector, MobileConnectionFlowInitializer.IMobileSettingsProvider { + [SerializeField] private EntityRepresentationMapping entityRepresentationMapping = default; + #pragma warning disable 649 [SerializeField] private string ipAddress; #pragma warning restore 649 @@ -45,6 +49,7 @@ public async void Start() protected override void HandleWorkerConnectionEstablished() { PlayerLifecycleHelper.AddClientSystems(Worker.World); + GameObjectCreationHelper.EnableStandardGameObjectCreation(Worker.World, entityRepresentationMapping); } public Option GetReceptionistHostIp() diff --git a/workers/unity/Assets/BlankProject/Scripts/Workers/UnityClientConnector.cs b/workers/unity/Assets/BlankProject/Scripts/Workers/UnityClientConnector.cs index d4b776652..f0ba0005f 100644 --- a/workers/unity/Assets/BlankProject/Scripts/Workers/UnityClientConnector.cs +++ b/workers/unity/Assets/BlankProject/Scripts/Workers/UnityClientConnector.cs @@ -1,5 +1,7 @@ using System; using Improbable.Gdk.Core; +using Improbable.Gdk.Core.Representation; +using Improbable.Gdk.GameObjectCreation; using Improbable.Gdk.PlayerLifecycle; using UnityEngine; @@ -7,6 +9,8 @@ namespace BlankProject { public class UnityClientConnector : WorkerConnector { + [SerializeField] private EntityRepresentationMapping entityRepresentationMapping = default; + public const string WorkerType = "UnityClient"; private async void Start() @@ -42,6 +46,7 @@ private async void Start() protected override void HandleWorkerConnectionEstablished() { PlayerLifecycleHelper.AddClientSystems(Worker.World); + GameObjectCreationHelper.EnableStandardGameObjectCreation(Worker.World, entityRepresentationMapping); } } } diff --git a/workers/unity/Assets/BlankProject/Scripts/Workers/UnityGameLogicConnector.cs b/workers/unity/Assets/BlankProject/Scripts/Workers/UnityGameLogicConnector.cs index d7cbf3bc9..9c3914de6 100644 --- a/workers/unity/Assets/BlankProject/Scripts/Workers/UnityGameLogicConnector.cs +++ b/workers/unity/Assets/BlankProject/Scripts/Workers/UnityGameLogicConnector.cs @@ -1,5 +1,7 @@ using BlankProject.Scripts.Config; using Improbable.Gdk.Core; +using Improbable.Gdk.Core.Representation; +using Improbable.Gdk.GameObjectCreation; using Improbable.Gdk.PlayerLifecycle; using Improbable.Worker.CInterop; using UnityEngine; @@ -8,6 +10,8 @@ namespace BlankProject { public class UnityGameLogicConnector : WorkerConnector { + [SerializeField] private EntityRepresentationMapping entityRepresentationMapping = default; + public const string WorkerType = "UnityGameLogic"; private async void Start() @@ -41,6 +45,7 @@ protected override void HandleWorkerConnectionEstablished() { Worker.World.GetOrCreateSystem(); PlayerLifecycleHelper.AddServerSystems(Worker.World); + GameObjectCreationHelper.EnableStandardGameObjectCreation(Worker.World, entityRepresentationMapping); } } } diff --git a/workers/unity/Assets/Config/ClientPrefabMapping.asset b/workers/unity/Assets/Config/ClientPrefabMapping.asset new file mode 100644 index 000000000..7d769574f --- /dev/null +++ b/workers/unity/Assets/Config/ClientPrefabMapping.asset @@ -0,0 +1,17 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f0598980a22146e5bb63df7b024cf2b0, type: 3} + m_Name: ClientPrefabMapping + m_EditorClassIdentifier: + EntityRepresentationResolvers: [] + references: + version: 1 diff --git a/workers/unity/Assets/Resources.meta b/workers/unity/Assets/Config/ClientPrefabMapping.asset.meta similarity index 54% rename from workers/unity/Assets/Resources.meta rename to workers/unity/Assets/Config/ClientPrefabMapping.asset.meta index 240e426d8..cbf406f29 100644 --- a/workers/unity/Assets/Resources.meta +++ b/workers/unity/Assets/Config/ClientPrefabMapping.asset.meta @@ -1,8 +1,8 @@ fileFormatVersion: 2 -guid: ef6f036db74f744d687bb86196cc52fa -folderAsset: yes -DefaultImporter: +guid: 4e53a77235830e14ebca570b4ea233dc +NativeFormatImporter: externalObjects: {} + mainObjectFileID: 0 userData: assetBundleName: assetBundleVariant: diff --git a/workers/unity/Assets/Config/GamelogicPrefabMapping.asset b/workers/unity/Assets/Config/GamelogicPrefabMapping.asset new file mode 100644 index 000000000..7ecf3e18d --- /dev/null +++ b/workers/unity/Assets/Config/GamelogicPrefabMapping.asset @@ -0,0 +1,17 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f0598980a22146e5bb63df7b024cf2b0, type: 3} + m_Name: GamelogicPrefabMapping + m_EditorClassIdentifier: + EntityRepresentationResolvers: [] + references: + version: 1 diff --git a/workers/unity/Assets/Config/GamelogicPrefabMapping.asset.meta b/workers/unity/Assets/Config/GamelogicPrefabMapping.asset.meta new file mode 100644 index 000000000..d29ec3fc5 --- /dev/null +++ b/workers/unity/Assets/Config/GamelogicPrefabMapping.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: d7177170b2dc0444f82f6d4d018797e0 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/workers/unity/Assets/Resources/Prefabs.meta b/workers/unity/Assets/Prefabs.meta similarity index 100% rename from workers/unity/Assets/Resources/Prefabs.meta rename to workers/unity/Assets/Prefabs.meta diff --git a/workers/unity/Assets/Resources/Prefabs/Worker.meta b/workers/unity/Assets/Prefabs/Worker.meta similarity index 100% rename from workers/unity/Assets/Resources/Prefabs/Worker.meta rename to workers/unity/Assets/Prefabs/Worker.meta diff --git a/workers/unity/Assets/Resources/Prefabs/Worker/ClientWorker.prefab b/workers/unity/Assets/Prefabs/Worker/ClientWorker.prefab similarity index 92% rename from workers/unity/Assets/Resources/Prefabs/Worker/ClientWorker.prefab rename to workers/unity/Assets/Prefabs/Worker/ClientWorker.prefab index 42a504672..8fca446fc 100644 --- a/workers/unity/Assets/Resources/Prefabs/Worker/ClientWorker.prefab +++ b/workers/unity/Assets/Prefabs/Worker/ClientWorker.prefab @@ -44,3 +44,5 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: MaxConnectionAttempts: 3 + entityRepresentationMapping: {fileID: 11400000, guid: 4e53a77235830e14ebca570b4ea233dc, + type: 2} diff --git a/workers/unity/Assets/Resources/Prefabs/Worker/ClientWorker.prefab.meta b/workers/unity/Assets/Prefabs/Worker/ClientWorker.prefab.meta similarity index 100% rename from workers/unity/Assets/Resources/Prefabs/Worker/ClientWorker.prefab.meta rename to workers/unity/Assets/Prefabs/Worker/ClientWorker.prefab.meta diff --git a/workers/unity/Assets/Resources/Prefabs/Worker/GameLogicWorker.prefab b/workers/unity/Assets/Prefabs/Worker/GameLogicWorker.prefab similarity index 92% rename from workers/unity/Assets/Resources/Prefabs/Worker/GameLogicWorker.prefab rename to workers/unity/Assets/Prefabs/Worker/GameLogicWorker.prefab index 7cd020be0..1438a5058 100644 --- a/workers/unity/Assets/Resources/Prefabs/Worker/GameLogicWorker.prefab +++ b/workers/unity/Assets/Prefabs/Worker/GameLogicWorker.prefab @@ -44,3 +44,5 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: MaxConnectionAttempts: 3 + entityRepresentationMapping: {fileID: 11400000, guid: d7177170b2dc0444f82f6d4d018797e0, + type: 2} diff --git a/workers/unity/Assets/Resources/Prefabs/Worker/GameLogicWorker.prefab.meta b/workers/unity/Assets/Prefabs/Worker/GameLogicWorker.prefab.meta similarity index 100% rename from workers/unity/Assets/Resources/Prefabs/Worker/GameLogicWorker.prefab.meta rename to workers/unity/Assets/Prefabs/Worker/GameLogicWorker.prefab.meta diff --git a/workers/unity/Assets/Resources/Prefabs/Worker/MobileClientWorker.prefab b/workers/unity/Assets/Prefabs/Worker/MobileClientWorker.prefab similarity index 92% rename from workers/unity/Assets/Resources/Prefabs/Worker/MobileClientWorker.prefab rename to workers/unity/Assets/Prefabs/Worker/MobileClientWorker.prefab index d5a39f19e..88c3a7dc1 100644 --- a/workers/unity/Assets/Resources/Prefabs/Worker/MobileClientWorker.prefab +++ b/workers/unity/Assets/Prefabs/Worker/MobileClientWorker.prefab @@ -44,4 +44,6 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: MaxConnectionAttempts: 3 + entityRepresentationMapping: {fileID: 11400000, guid: 4e53a77235830e14ebca570b4ea233dc, + type: 2} ipAddress: diff --git a/workers/unity/Assets/Resources/Prefabs/Worker/MobileClientWorker.prefab.meta b/workers/unity/Assets/Prefabs/Worker/MobileClientWorker.prefab.meta similarity index 100% rename from workers/unity/Assets/Resources/Prefabs/Worker/MobileClientWorker.prefab.meta rename to workers/unity/Assets/Prefabs/Worker/MobileClientWorker.prefab.meta