diff --git a/com.unity.asset-store-tools/CHANGELOG.md b/com.unity.asset-store-tools/CHANGELOG.md index fa52591..84d5895 100644 --- a/com.unity.asset-store-tools/CHANGELOG.md +++ b/com.unity.asset-store-tools/CHANGELOG.md @@ -1,6 +1,15 @@ # Changelog All notable changes to this package will be documented in this file. +## [11.2.2] - 2023-02-23 + +### Validator Changes + +- Updated the 'LOD Setup' test to address some issues + - Added additional checks for LOD renderers (inactive renderer check, LOD Group reference check, relative hierarchy position to LOD Group check) + - LOD Group Component is no longer required to be on the root of the Prefab + - Updated the test result message interface when invalid Prefabs are found + ## [11.2.1] - 2023-01-17 ### Uploader Changes diff --git a/com.unity.asset-store-tools/Editor/AssetStoreUploader/Scripts/AssetStoreAPI.cs b/com.unity.asset-store-tools/Editor/AssetStoreUploader/Scripts/AssetStoreAPI.cs index c321e30..4bfe1c9 100644 --- a/com.unity.asset-store-tools/Editor/AssetStoreUploader/Scripts/AssetStoreAPI.cs +++ b/com.unity.asset-store-tools/Editor/AssetStoreUploader/Scripts/AssetStoreAPI.cs @@ -19,7 +19,8 @@ namespace AssetStoreTools.Uploader /// internal static class AssetStoreAPI { - public const string ToolVersion = "V6.2.1"; + public const string ToolVersion = "V6.2.2"; + private const string UnauthSessionId = "26c4202eb475d02864b40827dfff11a14657aa41"; private const string KharmaSessionId = "kharma.sessionid"; private const int UploadResponseTimeoutMs = 10000; diff --git a/com.unity.asset-store-tools/Editor/AssetStoreValidator/Scripts/TestActions.cs b/com.unity.asset-store-tools/Editor/AssetStoreValidator/Scripts/TestActions.cs index 7848c17..4beecec 100644 --- a/com.unity.asset-store-tools/Editor/AssetStoreValidator/Scripts/TestActions.cs +++ b/com.unity.asset-store-tools/Editor/AssetStoreValidator/Scripts/TestActions.cs @@ -938,19 +938,23 @@ public TestResult _17_CheckLODsonyourPrefabs() }; var prefabs = GetObjectsFromAssets(FileType.Prefab); - var badPrefabs = new List(); + var badPrefabs = new Dictionary>(); foreach (var o in prefabs) { var p = (GameObject)o; - var meshFilters = p.GetComponentsInChildren(); - var hasLODGroup = p.TryGetComponent(out _); + var meshFilters = p.GetComponentsInChildren(true); + var badMeshFilters = new List(); + var lodGroups = p.GetComponentsInChildren(true); - foreach (MeshFilter mf in meshFilters) + foreach (var mf in meshFilters) { - if (mf.name.Contains("LOD") && !hasLODGroup) - badPrefabs.Add(p); + if (mf.name.Contains("LOD") && !IsPartOfLodGroup(mf, lodGroups)) + badMeshFilters.Add(mf); } + + if (badMeshFilters.Count > 0) + badPrefabs.Add(p, badMeshFilters); } if (badPrefabs.Count <= 0) @@ -960,11 +964,32 @@ public TestResult _17_CheckLODsonyourPrefabs() } result.Result = TestResult.ResultStatus.Warning; - result.AddMessage("The following prefabs do not meet the LOD requirements", null, badPrefabs.ToArray()); + result.AddMessage("The following prefabs do not meet the LOD requirements"); + + foreach (var p in badPrefabs) + { + var resultList = new List(); + resultList.Add(p.Key); + resultList.AddRange(p.Value); + result.AddMessage($"{p.Key.name}.prefab", new MessageActionOpenAsset(p.Key), resultList.ToArray()); + } return result; } + private bool IsPartOfLodGroup(MeshFilter mf, LODGroup[] lodGroups) + { + foreach(var lodGroup in lodGroups) + { + // If MeshFilter is a child/deep child of a LodGroup AND is referenced in this LOD group - it is valid + if (mf.transform.IsChildOf(lodGroup.transform) && + lodGroup.GetLODs().Any(lod => lod.renderers.Any(renderer => renderer != null && renderer.gameObject == mf.gameObject))) + return true; + } + + return false; + } + #endregion #region 18_ShaderCompilerErrors diff --git a/com.unity.asset-store-tools/Editor/AssetStoreValidator/Tests/17_CheckLODs.asset b/com.unity.asset-store-tools/Editor/AssetStoreValidator/Tests/17_CheckLODs.asset index f2e0f5d..1167286 100644 --- a/com.unity.asset-store-tools/Editor/AssetStoreValidator/Tests/17_CheckLODs.asset +++ b/com.unity.asset-store-tools/Editor/AssetStoreValidator/Tests/17_CheckLODs.asset @@ -15,10 +15,13 @@ MonoBehaviour: HasBeenInitialized: 1 Id: 17 Title: LOD setup - Description: "We do not allow prefabs that contain a mesh with LOD written in\r - its name, but without an LOD element or more than 1 mesh attached. Please\r make - sure that LODs are correctly set up in the prefab. Refer to the LODGroup\r Manual - to set up your LODs." + Description: 'Prefabs containing meshes with ''LOD'' in their name must meet the + following requirements: + + - LOD Mesh must be referenced by an LOD Group Component + + - + LOD Mesh GameObject must be a child of an LOD Group Component' TestMethodName: _17_CheckLODsonyourPrefabs ErrorCategory: Filter: diff --git a/com.unity.asset-store-tools/package.json b/com.unity.asset-store-tools/package.json index c78b153..e73488d 100644 --- a/com.unity.asset-store-tools/package.json +++ b/com.unity.asset-store-tools/package.json @@ -1,7 +1,7 @@ { "name": "com.unity.asset-store-tools", "displayName": "Asset Store Tools", - "version": "11.2.1", + "version": "11.2.2", "unity": "2019.4", "description": "Whether you're a programmer, game designer, texture artist or 3D modeler, you're welcome to share your creations with everybody in the Unity developer community!", "type": "tool"