I encountered an issue when testing out the Sandbox Template of the Needle Engine. Below is my specs:
- OS: Ubuntu 24.04
- Unity: 6000.0.32f1
- Needle Engine: 3.51.1
- Node: v20.15.1
When I press “Play” for the Unity game, the build fails. Here is the error message:
InvalidOperationException: Process must exit before requested information can be determined.
System.Diagnostics.Process.EnsureState (System.Diagnostics.Process+State state) (at <8d1920f66fd6494ebe24fa42f014ba27>:0)
System.Diagnostics.Process.get_ExitCode () (at <8d1920f66fd6494ebe24fa42f014ba27>:0)
Needle.Engine.Utils.ProcessHelper.RunCommand (System.String command, System.String workingDirectory, System.String logFilePath, System.Boolean noWindow, System.Boolean logToConsole, System.Nullable`1[T] parentId, System.Threading.CancellationToken cancellationToken, System.Action`2[T1,T2] onLog) (at ./Library/PackageCache/com.needle.engine-exporter/Common/Runtime/Utils/ProcessHelper.cs:272)
Needle.Engine.Core.Builder.InternalOnBuild (Needle.Engine.Core.BuildContext buildContext, Needle.Engine.ProjectInfo projectPaths, Needle.Engine.Core.BuildInfo info) (at ./Library/PackageCache/com.needle.engine-exporter/Core/Editor/Core/Builder.cs:508)
Needle.Engine.Core.Builder.Build (System.Boolean isImplicitExport, Needle.Engine.Core.BuildContext buildContext, System.Int32 parentTaskId, System.Nullable`1[T] info) (at ./Library/PackageCache/com.needle.engine-exporter/Core/Editor/Core/Builder.cs:221)
UnityEngine.Debug:LogException(Exception)
Needle.Engine.Core.<Build>d__33:MoveNext() (at ./Library/PackageCache/com.needle.engine-exporter/Core/Editor/Core/Builder.cs:247)
System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1:SetException(Exception)
Needle.Engine.Core.<InternalOnBuild>d__35:MoveNext() (at ./Library/PackageCache/com.needle.engine-exporter/Core/Editor/Core/Builder.cs:614)
System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1:SetException(Exception)
Needle.Engine.Utils.<RunCommand>d__5:MoveNext() (at ./Library/PackageCache/com.needle.engine-exporter/Common/Runtime/Utils/ProcessHelper.cs:274)
UnityEngine.UnitySynchronizationContext:ExecuteTasks() (at /home/bokken/build/output/unity/unity/Runtime/Export/Scripting/UnitySynchronizationContext.cs:110)
To reproduce bug (as presented in the docs):
- Install Unity
- Install NodeJS
- Download the NE unitypackage
- Start Unity
- Import NE package
- Create NE project with Vite
- Start the Vite server
- Press “Play” - error occurs
I was able to modify the C# code for NE and determine that this line (within ProcessHelper
) is the issue:
var code = proc?.ExitCode ?? -1;
By replacing with var code = -1;
, the InvalidOperationException
is not raised. I proposed adding a try-except here to prevent an uncaught exception.
Y’all are the best, thank you for the excellent dev experience!
Eduardo Davalos