Unity-Technologies/UnityCsReference · error · NoTargetsFoundException

Could not launch build

Error message

Could not launch build

What it means

NoTargetsFoundException with message 'Could not launch build' is thrown after the deployment task manager runs all launch attempts and zero launches succeeded. It aggregates per-target failures logged via Debug.LogException, then signals that no compatible target was available.

Source

Thrown at Editor/Mono/BuildPipeline/PostprocessBuildPlayer.cs:284

                            if (launchResult != null && launchResult.Success)
                                successfulLaunches++;
                        }
                        catch (DeploymentOperationFailedException e)
                        {
                            launchResult = e.launchResult;
                            exceptions.Add(e);
                        }

                        launches.Add(launchResult);
                    }

                    foreach (var e in exceptions)
                        UnityEngine.Debug.LogException(e);

                    if (successfulLaunches == 0)
                    {
                        // TODO: Maybe more specifically no compatible targets?
                        throw new NoTargetsFoundException("Could not launch build");
                    }
                });

                taskManager.Run();
            }
            catch (DeploymentOperationFailedException e)
            {
                UnityEngine.Debug.LogException(e);
                EditorUtility.DisplayDialog(e.title, e.Message, "OK");
            }
            catch (DeploymentOperationAbortedException)
            {
                System.Console.WriteLine("Deployment aborted");
            }
            catch (NoTargetsFoundException e)
            {
                Debug.LogException(e);
                throw new UnityException(string.Format("Could not find any valid targets to launch on for {0}", buildTarget));

View on GitHub (pinned to 225b0fbdb5)

Solutions

  1. Connect and authorize at least one compatible device/emulator for the target platform before Build and Run.
  2. Inspect the Debug.LogException entries emitted just before this throw to find the per-target failure cause.
  3. If launching to a remote target, verify it is online and reachable, then retry.

Example fix

/* no source edit */
// before: Build and Run with no device attached -> NoTargetsFoundException
// after: connect + authorize device (e.g. `adb devices` shows it, or boot the simulator)
// then Build and Run
Defensive patterns

Strategy: try-catch

Validate before calling

// Verify at least one candidate target is discoverable before launching
if (DeploymentTargets.Count(buildTarget) == 0)
    EditorUtility.DisplayDialog("Launch", $"No connected target for {buildTarget}.", "OK");

Try / catch

try { launches = PostprocessBuildPlayer.LaunchPlayer(...); }
catch (NoTargetsFoundException ex)
{ Debug.LogWarning($"No launch target: {ex.Message}"); launches = new List<LaunchResult>(); }

Prevention

When it happens

Trigger: The launch/deployment flow enumerates candidate targets to run on, but every candidate failed its launch attempt (device disconnected, emulator not running, incompatible target) leaving successfulLaunches == 0.

Common situations: Launching to a mobile/AR platform with no device or emulator connected; all candidate devices rejected the build (wrong OS version, locked device); network-deployed targets unreachable.

Related errors


AI-assisted analysis of Unity-Technologies/UnityCsReference@225b0fbdb5 (2026-08-13). Data as JSON: /api/errors/89a16c1cf75166e2. Report an issue: GitHub.