public static bool ValidateCurrentScene() { var compRoot = GameObject.FindObjectsOfType <CompositionRoot>().OnlyOrDefault(); if (compRoot == null) { Log.Error("Unable to find unique composition root in current scene"); return(false); } if (compRoot.Installers.IsEmpty()) { Log.Warn("Could not find installers while validating current scene"); // Return true to allow playing in this case return(true); } // Only show a few to avoid spamming the log too much var resolveErrors = ZenEditorUtil.ValidateInstallers(compRoot).Take(10).ToList(); foreach (var error in resolveErrors) { Log.ErrorException(error); } if (resolveErrors.Any()) { Log.Error("Validation Completed With Errors"); return(false); } Log.Info("Validation Completed Successfully"); return(true); }
public static IEnumerable <ZenjectResolveException> ValidateCurrentScene() { var compRoot = GameObject.FindObjectsOfType <CompositionRoot>().OnlyOrDefault(); if (compRoot == null || compRoot.Installers.IsEmpty()) { return(Enumerable.Empty <ZenjectResolveException>()); } return(ZenEditorUtil.ValidateInstallers(compRoot)); }