Sha256: 86fc4d20fce48c51a6497aab53fd596af03a4ce1a7dbc12ac2a8abd0716215a4

Contents?: true

Size: 1.01 KB

Versions: 27

Compression:

Stored size: 1.01 KB

Contents

using UnityEditor;
using UnityEngine;
using System.Collections.Generic;
using System.IO;
using System;

namespace U3d {
  class EditorRun {
    [MenuItem ("U3d/Example/Build")]
    static void Build() {
      Debug.Log("Building Example2");

      BuildPlayer(EditorBuildSettings.scenes, "target/Example2.app", BuildTarget.StandaloneOSXIntel64, BuildOptions.None);
    }

    private static void BuildPlayer(EditorBuildSettingsScene[] scenes, string target_dir, BuildTarget build_target, BuildOptions build_options) {
      FileSystemUtil.EnsureParentExists(target_dir);
      string res = BuildPipeline.BuildPlayer(scenes, target_dir, build_target, build_options);
      if (res.Length > 0) {
        throw new Exception("BuildPlayer failure: " + res);
      }      
    }
  }

  class FileSystemUtil {
    public static void EnsureParentExists(string target_dir) {
      DirectoryInfo parent = Directory.GetParent(target_dir);
      if (!parent.Exists) {
        Directory.CreateDirectory(parent.FullName);
      }
    }    
  }
}

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
u3d-1.0.0 examples/Example2/Assets/Editor/EditorRun.cs
u3d-1.0.0.rc1 examples/Example2/Assets/Editor/EditorRun.cs
u3d-0.9.4 examples/Example2/Assets/Editor/EditorRun.cs
u3d-0.9.3 examples/Example2/Assets/Editor/EditorRun.cs
u3d-0.9.2 examples/Example2/Assets/Editor/EditorRun.cs
u3d-0.9.1 examples/Example2/Assets/Editor/EditorRun.cs
u3d-0.9 examples/Example2/Assets/Editor/EditorRun.cs