Skip to content

🔧 Command line tool for locating the version of Unity that a project was built with

Notifications You must be signed in to change notification settings

neogeek/find-unity

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

find-unity

Command line tool for locating the version of Unity that a project was built with

GitHub tag (latest SemVer)

Install

$ brew tap neogeek/find-unity
$ brew install find-unity

Usage

Bash

$ find-unity
Usage: find-unity [options]

OPTIONS:
   -v     show the version number and then exit
   -h     show this help message and then exit

   -e     path to search for Unity editors
   -f     file to checking project specific version number

Unity

Editor/Build.cs

using System.Linq;
using UnityEditor;
using UnityEditor.Build.Reporting;
using UnityEngine;

public static class Build
{

    [MenuItem("Build/Build All")]
    public static void BuildAll()
    {

        BuildAndroid();

        BuildIOS();

    }

    [MenuItem("Build/Build Android")]
    public static void BuildAndroid()
    {

        var report = BuildPipeline.BuildPlayer(new BuildPlayerOptions
        {
            locationPathName = "Builds/Android.apk",
            scenes = EditorBuildSettings.scenes.Select(s => s.path).ToArray(),
            target = BuildTarget.Android,
            options = BuildOptions.None
        });

        Debug.Log(
            $"Android build {(report.summary.result.Equals(BuildResult.Succeeded) ? "completed" : "failed")}.");

    }

    [MenuItem("Build/Build iOS")]
    public static void BuildIOS()
    {

        var report = BuildPipeline.BuildPlayer(new BuildPlayerOptions
        {
            locationPathName = "Builds/iOS",
            scenes = EditorBuildSettings.scenes.Select(s => s.path).ToArray(),
            target = BuildTarget.iOS,
            options = BuildOptions.None
        });

        Debug.Log($"iOS build {(report.summary.result.Equals(BuildResult.Succeeded) ? "completed" : "failed")}.");

    }

}

Makefile

build-all: build-android build-ios

build-android:
	"$(shell find-unity)/Contents/MacOS/Unity" -projectPath "$(shell pwd)/" -batchmode -quit -executeMethod "Build.BuildAndroid"

build-ios:
	"$(shell find-unity)/Contents/MacOS/Unity" -projectPath "$(shell pwd)/" -batchmode -quit -executeMethod "Build.BuildIOS"

clean:
	git clean -xdf

Bash

$ make build-all

About

🔧 Command line tool for locating the version of Unity that a project was built with

Resources

Stars

Watchers

Forks

Sponsor this project

Packages

No packages published