public void Test() { var results = new List <TestResult>(); GameObjectProcessor.ProcessAllScenes ( scenePathFilter: path => path.StartsWith("Assets"), onProcess: gameObject => { var com = gameObject.GetComponent <PrefabOverrideTestComponent>(); if (com == null) { return(GameObjectProcessResult.NOT_CHANGE); } var hasOverrides = PrefabUtility.HasPrefabInstanceAnyOverrides ( instanceRoot: gameObject, includeDefaultOverrides: false ); if (!hasOverrides) { return(GameObjectProcessResult.NOT_CHANGE); } var result = new TestResult(gameObject); results.Add(result); return(GameObjectProcessResult.NOT_CHANGE); } ); if (results.Count <= 0) { return; } var builder = new StringBuilder(); foreach (var result in results) { result.WriteTo(builder); } Assert.Fail(builder.ToString().TrimEnd()); }
public void Test() { var results = new List <TestResult>(); GameObjectProcessor.ProcessAllPrefabs ( prefabPathFilter: path => path.StartsWith("Assets"), onProcess: gameObject => { var layoutGroup = gameObject.GetComponent <LayoutGroup>(); var contentSizeFitter = gameObject.GetComponent <ContentSizeFitter>(); if (layoutGroup == null) { return(GameObjectProcessResult.NOT_CHANGE); } if (contentSizeFitter == null) { return(GameObjectProcessResult.NOT_CHANGE); } if (!layoutGroup.enabled && !contentSizeFitter.enabled) { return(GameObjectProcessResult.NOT_CHANGE); } var result = new TestResult(gameObject); results.Add(result); return(GameObjectProcessResult.NOT_CHANGE); } ); if (results.Count <= 0) { return; } var builder = new StringBuilder(); foreach (var result in results) { result.WriteTo(builder); } Assert.Fail(builder.ToString().TrimEnd()); }