egametang/ET · critical
命令行格式错误! {error}
Error message
命令行格式错误! {error} What it means
Thrown inside the Unity client Init MonoBehaviour (Scripts/Loader/Client/Init.cs) when CommandLineParser fails to parse the synthetic args array built from GlobalConfig.SceneName. Unlike the server entry (207), these args are constructed in-code as { $"--SceneName={globalConfig.SceneName}" }, so a parse failure almost always means GlobalConfig.SceneName is malformed or GlobalConfig itself failed to load.
Source
Thrown at Packages/cn.etetet.loader/Scripts/Loader/Client/Init.cs:27
private void Start()
{
this.StartAsync().Coroutine();
}
private async ETTask StartAsync()
{
DontDestroyOnLoad(gameObject);
AppDomain.CurrentDomain.UnhandledException += (sender, e) =>
{
Log.Error(e.ExceptionObject.ToString());
};
GlobalConfig globalConfig = Resources.Load<GlobalConfig>("GlobalConfig");
// 命令行参数
string[] args = { $"--SceneName={globalConfig.SceneName}" };
Parser.Default.ParseArguments<Options>(args)
.WithNotParsed(error => throw new Exception($"命令行格式错误! {error}"))
.WithParsed((o)=>World.Instance.AddSingleton(o));
// 编辑器模式下如果开启了ENABLE_VIEW使用单线程,WEBGL模式也使用单线程
#if (ENABLE_VIEW && UNITY_EDITOR) || UNITY_WEBGL
Options.Instance.SingleThread = 1;
#endif
World.Instance.AddSingleton<Logger>().Log = new UnityLogger("None");
ETTask.ExceptionHandler += Log.Error;
World.Instance.AddSingleton<TimeInfo>();
World.Instance.AddSingleton<FiberManager>();
await World.Instance.AddSingleton<ResourcesComponent>().CreatePackageAsync("DefaultPackage", true);
World.Instance.AddSingleton<CodeLoader>().Start().Coroutine();View on GitHub (pinned to 5cab01f7a8)
Solutions
- Verify GlobalConfig.asset exists under a Resources/ folder and its SceneName is a valid, non-empty value.
- Null-check the Resources.Load result before using globalConfig and log a clear error.
- Ensure SceneName matches an actual configured scene name expected by Options.
Example fix
// before
GlobalConfig globalConfig = Resources.Load<GlobalConfig>("GlobalConfig");
string[] args = { $"--SceneName={globalConfig.SceneName}" };
// after
GlobalConfig globalConfig = Resources.Load<GlobalConfig>("GlobalConfig");
if (globalConfig == null || string.IsNullOrEmpty(globalConfig.SceneName))
throw new Exception("GlobalConfig missing or SceneName empty");
string[] args = { $"--SceneName={globalConfig.SceneName}" }; Defensive patterns
Strategy: validation
Validate before calling
GlobalConfig globalConfig = Resources.Load<GlobalConfig>("GlobalConfig");
if (globalConfig == null || string.IsNullOrEmpty(globalConfig.SceneName))
{
Log.Error("GlobalConfig missing or SceneName empty");
return;
} Prevention
- Always null-check Resources.Load results.
- Keep GlobalConfig.asset in a Resources/ folder and validate it in a build step.
- Ensure SceneName matches a real configured scene.
When it happens
Trigger: Resources.Load<GlobalConfig>("GlobalConfig") returns null (asset missing) and globalConfig.SceneName dereference NPEs, OR SceneName contains characters that break the --SceneName= token (spaces/quotes handled oddly). WithNotParsed then throws.
Common situations: GlobalConfig.asset not present in a Resources folder after a build; SceneName field left empty or set to an invalid value in the inspector; a rename of the scene without updating the GlobalConfig.
Related errors
- 命令行格式错误! {error}
- http request fail: {link.Substring(0,link.IndexOf('?'))}\n{e
- condition variable node must inherit BTCondition: {type.Full
- condition variable is empty: {type.FullName}
- duplicate condition variable: {conditionVariableAttribute.Va
AI-assisted analysis of egametang/ET@5cab01f7a8 (2026-08-13).
Data as JSON: /api/errors/17162fa9a6f42f26.
Report an issue: GitHub.