@@ -37,17 +37,17 @@ public static IHostBuilder UseUnityLifetime(this IHostBuilder hostBuilder) =>
3737 /// Configure <see cref="IHost"/> to sensible defaults for Unity
3838 /// </summary>
3939 /// <param name="configureOptions">The delegate for configuring the <see cref="UnityLifetime"/>.</param>
40- /// <param name="ignoreCommandLineArgs">Don't add command line parameters. Defaults to false </param>
41- /// <param name="ignoreEnvironmentVariables">Don't add environment variables. Defaults to false </param>
40+ /// <param name="ignoreCommandLineArgs">Don't add command line parameters</param>
41+ /// <param name="ignoreEnvironmentVariables">Don't add environment variables</param>
4242 /// <param name="jsonConfigurations">Text assets which contain json data. Load the files using <see cref="Resources.Load(string)"/> or use the new Addressables package.</param>
4343 /// <returns>The original builder</returns>
4444 public static IHostBuilder UseUnity
4545 (
4646 this IHostBuilder builder ,
4747 Action < UnityLifeTimeOptions > configureOptions ,
48- bool ignoreCommandLineArgs = false ,
49- bool ignoreEnvironmentVariables = false ,
50- params TextAsset [ ] jsonConfigurations
48+ bool ignoreCommandLineArgs ,
49+ bool ignoreEnvironmentVariables ,
50+ TextAsset [ ] jsonConfigurations
5151 )
5252 {
5353 var resourcesFolder = Path . GetFullPath ( Application . dataPath ) ;
@@ -64,9 +64,12 @@ params TextAsset[] jsonConfigurations
6464 if ( ! ignoreCommandLineArgs ) configurationBuilder . AddCommandLine ( Environment . GetCommandLineArgs ( ) ) ;
6565 if ( ! ignoreEnvironmentVariables ) configurationBuilder . AddEnvironmentVariables ( ) ;
6666
67- foreach ( var jsonConfiguration in jsonConfigurations . Select ( c => c . text . ToStream ( ) ) )
67+ if ( jsonConfigurations != null )
6868 {
69- configurationBuilder . AddJsonStream ( jsonConfiguration ) ;
69+ foreach ( var jsonConfiguration in jsonConfigurations . Select ( c => c . text . ToStream ( ) ) )
70+ {
71+ configurationBuilder . AddJsonStream ( jsonConfiguration ) ;
72+ }
7073 }
7174 } ) ;
7275
0 commit comments