FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Add a quick "custom" build command by krisrok · Pull Request #199 · unitycoder/UnityLauncherPro · GitHub

Repository navigation

Add a quick "custom" build command - #199

Merged
unitycoder merged 1 commit into
unitycoder:masterfrom
krisrok:feature/build_custom
Aug 30, 2025
Merged

unitycoder merged 1 commit into
unitycoder:masterfrom
krisrok:feature/build_custom

Conversation

krisrok commented Aug 8, 2025

Copy link
Copy Markdown
Contributor

Expects a editor script with in the format of:

UnityLauncherProToolsCustom.BuildCustom, e.g.:

using System.Diagnostics;
using System.IO;
using System.Linq;
using UnityEditor;
using UnityEngine;
public static class UnityLauncherProToolsCustom
{
    [MenuItem("Tools/Build custom")]
    public static void BuildCustom()
    {
        var settings = new BuildPlayerOptions();
        settings.scenes = GetScenes();
        settings.locationPathName = Path.GetFullPath(Path.Combine(Application.dataPath, "..", "..", "..", "Build", PlayerSettings.productName + ".exe"));
        settings.target = EditorUserBuildSettings.activeBuildTarget;
        var report = BuildPipeline.BuildPlayer(settings);
        if (report.summary.result == UnityEditor.Build.Reporting.BuildResult.Succeeded)
            Process.Start(Path.GetDirectoryName(settings.locationPathName));
    }

    static string[] GetScenes()
    {
        return EditorBuildSettings.scenes.Where(scene => scene.enabled).Select(scene => scene.path).ToArray();
    }
}

Expects a editor script with in the format of:

```cs
using System.Diagnostics;
using System.IO;
using System.Linq;
using UnityEditor;
using UnityEngine;
public static class UnityLauncherProToolsCustom
{
    [MenuItem("Tools/Build custom")]
    public static void BuildCustom()
    {
        var settings = new BuildPlayerOptions();
        settings.scenes = GetScenes();
        settings.locationPathName = Path.GetFullPath(Path.Combine(Application.dataPath, "..", "..", "..", "Build", PlayerSettings.productName + ".exe"));
        settings.target = EditorUserBuildSettings.activeBuildTarget;
        var report = BuildPipeline.BuildPlayer(settings);
        if (report.summary.result == UnityEditor.Build.Reporting.BuildResult.Succeeded)
            Process.Start(Path.GetDirectoryName(settings.locationPathName));
    }

    static string[] GetScenes()
    {
        return EditorBuildSettings.scenes.Where(scene => scene.enabled).Select(scene => scene.path).ToArray();
    }
}
```

Copy link
Copy Markdown
Owner

thanks ill check!

question:
so i guess there is no easy way to check if that custom build script is available?
unless its in some fixed path Assets/Editor/UnityLauncherProToolsCustom.cs,
then could disable that menu item, if not available.

unitycoder commented Aug 24, 2025 •
edited
Loading

Copy link
Copy Markdown
Owner

i'm thinking that this could have a settings field, for your own custom script to use for Builds.
And if the field is empty or no checkbox enabled, then it uses the current builtin one.

  • although then you cannot have different script per project.. so probably cannot do that.. ok skip this comment.

like init script:

unitycoder merged commit f90e8ac into unitycoder:master Aug 30, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL