public void It_should_detect_invalid_IDs_in_the_project() { var reporter = new UniqueIdReporter("Assets/Examples"); var report = reporter.GetReport(); // Use this instead to enforce unique project IDs on your project, set to not error here for sanity reasons // Assert.AreEqual(0, report.ErrorCount); Assert.AreNotEqual(0, report.ErrorCount); }
private void SearchScenes(List <SceneAsset> sceneAssets) { var startScenePath = SceneManager.GetActiveScene().path; ClearSearchResults(); var search = new UniqueIdReporter(sceneAssets); var report = search.GetReport(); var duplicateIDs = report.DuplicateIDs; report.Scenes.ForEach((scene) => { if (scene.Errors.Count == 0) { return; } void onFixId(ReportId error) { if (error.Id == null) { return; } duplicateIDs[error.Id] -= 1; if (duplicateIDs[error.Id] > 1) { return; } _searchedScenes.ForEach((s) => s.HideId(error.Id)); } var sceneSearch = new SceneSearch(_elSearchResults, scene, onFixId); _searchedScenes.Add(sceneSearch); }); _elSearchText.text = $"Searched {report.Scenes.Count} scenes"; if (report.ErrorCount == 0) { var elNoErrors = _container.Query <VisualElement>(null, "p-window__no-errors").First(); elNoErrors.AddToClassList("-show"); } EditorSceneManager.OpenScene(startScenePath, OpenSceneMode.Single); }