Last active
November 19, 2023 11:45
-
-
Save WikkidEdd/b572ce423969c114f6eea3b5a751f7d9 to your computer and use it in GitHub Desktop.
Creates a symlinked version of a Unity project so you can easily do network development. Add script to Editor folder. Run from "Utils/Create Symlink Project" then choose directory to put symlink'd project in.
This file contains 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.Diagnostics; | |
public class CreateSymlinkProject { | |
[MenuItem("Utils/Create Symlink Project")] | |
static void DoIt() | |
{ | |
string folderName = EditorUtility.SaveFolderPanel("Symlink Project Location", "", ""); | |
string newAssetFolder = folderName + "/Assets"; | |
string currentAssetFolder = Application.dataPath; | |
string newProjectSettingsFolder = folderName + "/ProjectSettings"; | |
string currentProjectSettingsFolder = Application.dataPath.Replace("Assets", "ProjectSettings"); | |
string newPackagesFolder = folderName + "/Packages"; | |
string currentPackagesFolder = Application.dataPath.Replace("Assets", "Packages"); | |
CreateSymlink(newAssetFolder, currentAssetFolder); | |
CreateSymlink(newProjectSettingsFolder, currentProjectSettingsFolder); | |
CreateSymlink(newPackagesFolder, currentPackagesFolder); | |
} | |
static void CreateSymlink(string newFolder, string linkFolder) | |
{ | |
Process.Start("cmd.exe", "/c mklink /D \"" + newFolder + "\" \"" + linkFolder + "\""); | |
} | |
} |
Thanks for this script!
Had some issues getting it to run on my computer though. Worked fine after manually opening cmd as administrator and running the cmds.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Super useful, thanks.
For mac or linux: