Created
February 22, 2014 16:33
-
-
Save cubed2d/9157573 to your computer and use it in GitHub Desktop.
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
| using UnityEngine; | |
| using UnityEditor; | |
| using System.Collections; | |
| using System.Diagnostics; | |
| public class NetworkBuilder | |
| { | |
| [MenuItem("Networking/Build and Run Server %#x")] | |
| public static void BuildAndRunServer() | |
| { | |
| Build("SirServer"); | |
| Run("SirServer", "-Server -Port 3435"); | |
| } | |
| [MenuItem("Networking/Build and Run Client")] | |
| public static void BuildAndRunClient() | |
| { | |
| Build("SirClient"); | |
| Run("SirClient", "-Client -IP 127.0.0.1 -Port 3435"); | |
| } | |
| // SHORTCUT Control+Shift+C | |
| [MenuItem("Networking/Build Client %#c")] | |
| public static void BuildClient() | |
| { | |
| Build("SirClient"); | |
| } | |
| // SHORTCUT Control+Shift+V | |
| [MenuItem("Networking/Run Client %#v")] | |
| public static void RunClient() | |
| { | |
| Run("SirClient", "-Client -IP 127.0.0.1 -Port 3435"); | |
| } | |
| private static Process Run(string buildName, string args = "") | |
| { | |
| return Process.Start | |
| ( | |
| new ProcessStartInfo() | |
| { | |
| FileName = @"D:/UnityBuilds/" + buildName+"/" + buildName +".exe", | |
| Arguments = args | |
| } | |
| ); | |
| } | |
| private static void Build(string buildName) | |
| { | |
| // this is an array of allthe scenes you want in the bild // target platform.... | |
| BuildPipeline.BuildPlayer(new[] { "Assets/Scenes/GameScene.unity" }, @"D:/UnityBuilds/" + buildName + "/" + buildName + ".exe", BuildTarget.StandaloneWindows, BuildOptions.Development | BuildOptions.AllowDebugging); | |
| // This is the path where you want it save // and make the build debugable! | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment