serverBuild

This commit is contained in:
Nim-XD 2025-06-10 23:57:03 +05:30
parent b6dfa0721e
commit 9b23d57c41
20 changed files with 12836 additions and 16 deletions

BIN
.DS_Store vendored

Binary file not shown.

BIN
Assets/.DS_Store vendored

Binary file not shown.

View File

@ -15645,6 +15645,7 @@ MonoBehaviour:
inPartyUI: {fileID: 6212582780142130674}
inPartyOwnerNameTxt: {fileID: 4157618920817146930}
charPartyText: {fileID: 3001089222309157174}
charPartyUI: {fileID: 8050475778169126891}
inPartyPlayersTxt: {fileID: 4763456039480402226}
inviteOwnerNameTxt: {fileID: 7030286270905106535}
uiCanvasGroup: {fileID: 2096525255603639546}
@ -30086,8 +30087,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: -0.0000076293945, y: -16.85}
m_SizeDelta: {x: -19.6109, y: -46.449}
m_AnchoredPosition: {x: -0.0000076293945, y: -20.5746}
m_SizeDelta: {x: -19.6109, y: -53.8982}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &50248178383363695
CanvasRenderer:
@ -30151,8 +30152,8 @@ MonoBehaviour:
m_fontSizeMin: 12
m_fontSizeMax: 20
m_fontStyle: 0
m_HorizontalAlignment: 2
m_VerticalAlignment: 512
m_HorizontalAlignment: 1
m_VerticalAlignment: 256
m_textAlignment: 65535
m_characterSpacing: 0
m_wordSpacing: 0

View File

@ -132,12 +132,14 @@ public class invitePlayer : NetworkBehaviour
if (ownerName.Length == 0)
{
inPartyUI.SetActive(false);
charPartyText.text = "";
charPartyUI.SetActive(false);
}
else
{
inPartyUI.SetActive(true);
inPartyOwnerNameTxt.text = $"{ownerName}'s Party";
inPartyOwnerNameTxt.text = charPartyText.text;
charPartyText.text = $"in {ownerName}'s party";
charPartyUI.SetActive(true);
playerNetwork[] players = FindObjectsOfType<playerNetwork>();
@ -154,9 +156,9 @@ public class invitePlayer : NetworkBehaviour
}
public void LeaveParty(){
//playerNetwork.localPlayer.CmdLeaveParty();
playerNetwork.localPlayer.CmdLeaveParty();
inPartyUI.SetActive(false);
charPartyUI.SetActive(false);
charPartyText.text = "";
// charPartyUI.SetActive(false);
// charPartyText.text = "";
}
}

View File

@ -281,6 +281,12 @@ public class playerNetwork : NetworkBehaviour
[Command]
public void CmdAcceptInvite(string otherPlayerName){
myPartyOwner = otherPlayerName;
Debug.Log("Invite accepted: " + myPartyOwner);
}
[Command]
public void CmdLeaveParty(){
myPartyOwner = null;
}
playerNetwork FindPlayerByName(string playerName){
@ -447,6 +453,7 @@ public class playerNetwork : NetworkBehaviour
invitePlayer.InParty(myPartyOwner);
}else{
invitePlayer.InParty("");
}
}
ShowXP();

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: ae79e2642882a4083839b121041cfaa4
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: b0e79e43e01ff3e4991e8902ac89b322
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,506 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
using System.Linq;
using System.Runtime.InteropServices;
using System.IO;
using UnityProjectCloner;
namespace UnityProjectCloner
{
/// <summary>
/// Contains all required methods for creating a linked clone of the Unity project.
/// </summary>
public class ProjectCloner
{
/// <summary>
/// Name used for an identifying file created in the clone project directory.
/// </summary>
/// <remarks>
/// (!) Do not change this after the clone was created, because then connection will be lost.
/// </remarks>
public const string CloneFileName = ".clone";
/// <summary>
/// Suffix added to the end of the project clone name when it is created.
/// </summary>
/// <remarks>
/// (!) Do not change this after the clone was created, because then connection will be lost.
/// </remarks>
public const string CloneNameSuffix = "_clone";
public const int MaxCloneProjectCount = 10;
#region Managing clones
/// <summary>
/// Creates clone from the project currently open in Unity Editor.
/// </summary>
/// <returns></returns>
public static Project CreateCloneFromCurrent()
{
if (IsClone())
{
Debug.LogError("This project is already a clone. Cannot clone it.");
return null;
}
string currentProjectPath = ProjectCloner.GetCurrentProjectPath();
return ProjectCloner.CreateCloneFromPath(currentProjectPath);
}
/// <summary>
/// Creates clone of the project located at the given path.
/// </summary>
/// <param name="sourceProjectPath"></param>
/// <returns></returns>
public static Project CreateCloneFromPath(string sourceProjectPath)
{
Project sourceProject = new Project(sourceProjectPath);
string cloneProjectPath = null;
//Find available clone suffix id
for (int i = 0; i < MaxCloneProjectCount; i++)
{
string originalProjectPath = ProjectCloner.GetCurrentProject().projectPath;
string possibleCloneProjectPath = originalProjectPath + ProjectCloner.CloneNameSuffix + "_" + i;
if (!Directory.Exists(possibleCloneProjectPath))
{
cloneProjectPath = possibleCloneProjectPath;
break;
}
}
if (string.IsNullOrEmpty(cloneProjectPath))
{
Debug.LogError("The number of cloned projects has reach its limit. Limit: " + MaxCloneProjectCount);
return null;
}
Project cloneProject = new Project(cloneProjectPath);
Debug.Log("Start project name: " + sourceProject);
Debug.Log("Clone project name: " + cloneProject);
ProjectCloner.CreateProjectFolder(cloneProject);
ProjectCloner.CopyLibraryFolder(sourceProject, cloneProject);
ProjectCloner.LinkFolders(sourceProject.assetPath, cloneProject.assetPath);
ProjectCloner.LinkFolders(sourceProject.projectSettingsPath, cloneProject.projectSettingsPath);
ProjectCloner.LinkFolders(sourceProject.packagesPath, cloneProject.packagesPath);
ProjectCloner.LinkFolders(sourceProject.autoBuildPath, cloneProject.autoBuildPath);
ProjectCloner.RegisterClone(cloneProject);
return cloneProject;
}
/// <summary>
/// Registers a clone by placing an identifying ".clone" file in its root directory.
/// </summary>
/// <param name="cloneProject"></param>
private static void RegisterClone(Project cloneProject)
{
/// Add clone identifier file.
string identifierFile = Path.Combine(cloneProject.projectPath, ProjectCloner.CloneFileName);
File.Create(identifierFile).Dispose();
/// Add collabignore.txt to stop the clone from messing with Unity Collaborate if it's enabled. Just in case.
string collabignoreFile = Path.Combine(cloneProject.projectPath, "collabignore.txt");
File.WriteAllText(collabignoreFile, "*"); /// Make it ignore ALL files in the clone.
}
/// <summary>
/// Opens a project located at the given path (if one exists).
/// </summary>
/// <param name="projectPath"></param>
public static void OpenProject(string projectPath)
{
if (!Directory.Exists(projectPath))
{
Debug.LogError("Cannot open the project - provided folder (" + projectPath + ") does not exist.");
return;
}
if (projectPath == ProjectCloner.GetCurrentProjectPath())
{
Debug.LogError("Cannot open the project - it is already open.");
return;
}
string fileName = EditorApplication.applicationPath;
string args = "-projectPath \"" + projectPath + "\"";
Debug.Log("Opening project \"" + fileName + " " + args + "\"");
ProjectCloner.StartHiddenConsoleProcess(fileName, args);
}
/// <summary>
/// Deletes the clone of the currently open project, if such exists.
/// </summary>
public static void DeleteClone(string cloneProjectPath)
{
/// Clone won't be able to delete itself.
if (ProjectCloner.IsClone()) return;
///Extra precautions.
if (cloneProjectPath == string.Empty) return;
if (cloneProjectPath == ProjectCloner.GetOriginalProjectPath()) return;
if (!cloneProjectPath.EndsWith(ProjectCloner.CloneNameSuffix)) return;
//Check what OS is
switch (Application.platform)
{
case (RuntimePlatform.WindowsEditor):
Debug.Log("Attempting to delete folder \"" + cloneProjectPath + "\"");
string args = "/c " + @"rmdir /s/q " + string.Format("\"{0}\"", cloneProjectPath);
StartHiddenConsoleProcess("cmd.exe", args);
break;
case (RuntimePlatform.OSXEditor):
throw new System.NotImplementedException("No Mac function implement yet :(");
//break;
case (RuntimePlatform.LinuxEditor):
throw new System.NotImplementedException("No linux support yet :(");
//break;
default:
Debug.LogWarning("Not in a known editor. Where are you!?");
break;
}
}
#endregion
#region Creating project folders
/// <summary>
/// Creates an empty folder using data in the given Project object
/// </summary>
/// <param name="project"></param>
public static void CreateProjectFolder(Project project)
{
string path = project.projectPath;
Debug.Log("Creating new empty folder at: " + path);
Directory.CreateDirectory(path);
}
/// <summary>
/// Copies the full contents of the unity library. We want to do this to avoid the lengthy reserialization of the whole project when it opens up the clone.
/// </summary>
/// <param name="sourceProject"></param>
/// <param name="destinationProject"></param>
public static void CopyLibraryFolder(Project sourceProject, Project destinationProject)
{
if (Directory.Exists(destinationProject.libraryPath))
{
Debug.LogWarning("Library copy: destination path already exists! ");
return;
}
Debug.Log("Library copy: " + destinationProject.libraryPath);
ProjectCloner.CopyDirectoryWithProgressBar(sourceProject.libraryPath, destinationProject.libraryPath, "Cloning project '" + sourceProject.name + "'. ");
}
#endregion
#region Creating symlinks
/// <summary>
/// Creates a symlink between destinationPath and sourcePath (Mac version).
/// </summary>
/// <param name="sourcePath"></param>
/// <param name="destinationPath"></param>
private static void CreateLinkMac(string sourcePath, string destinationPath)
{
// Debug.LogWarning("This hasn't been tested yet! I am mac-less :( Please chime in on the github if it works for you.");
string cmd = "-s " + string.Format("\"{0}\" \"{1}\"", sourcePath, destinationPath);
Debug.Log("Mac hard link " + cmd);
// ProjectCloner.StartHiddenConsoleProcess("/bin/zsh", cmd);
StartProcessWithShell("ln", cmd);
}
/// <summary>
/// Creates a symlink between destinationPath and sourcePath (Windows version).
/// </summary>
/// <param name="sourcePath"></param>
/// <param name="destinationPath"></param>
private static void CreateLinkWin(string sourcePath, string destinationPath)
{
string cmd = "/C mklink /J " + string.Format("\"{0}\" \"{1}\"", destinationPath, sourcePath);
Debug.Log("Windows junction: " + cmd);
ProjectCloner.StartHiddenConsoleProcess("cmd.exe", cmd);
}
/// <summary>
/// Creates a symlink between destinationPath and sourcePath (Linux version).
/// </summary>
/// <param name="sourcePath"></param>
/// <param name="destinationPath"></param>
private static void CreateLinkLunux(string sourcePath, string destinationPath)
{
string cmd = string.Format("-c \"ln -s {0} {1}\"", sourcePath, destinationPath);
Debug.Log("Linux junction: " + cmd);
ProjectCloner.StartHiddenConsoleProcess("/bin/bash", cmd);
}
//TODO avoid terminal calls and use proper api stuff. See below for windows!
////https://docs.microsoft.com/en-us/windows/desktop/api/ioapiset/nf-ioapiset-deviceiocontrol
//[DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)]
//private static extern bool DeviceIoControl(System.IntPtr hDevice, uint dwIoControlCode,
// System.IntPtr InBuffer, int nInBufferSize,
// System.IntPtr OutBuffer, int nOutBufferSize,
// out int pBytesReturned, System.IntPtr lpOverlapped);
/// <summary>
/// Create a link / junction from the real project to it's clone.
/// </summary>
/// <param name="sourcePath"></param>
/// <param name="destinationPath"></param>
public static void LinkFolders(string sourcePath, string destinationPath)
{
if ((Directory.Exists(destinationPath) == false) && (Directory.Exists(sourcePath) == true))
{
switch (Application.platform)
{
case (RuntimePlatform.WindowsEditor):
CreateLinkWin(sourcePath, destinationPath);
break;
case (RuntimePlatform.OSXEditor):
CreateLinkMac(sourcePath, destinationPath);
break;
case (RuntimePlatform.LinuxEditor):
CreateLinkLunux(sourcePath, destinationPath);
break;
default:
Debug.LogWarning("Not in a known editor. Where are you!?");
break;
}
}
else
{
Debug.LogWarning("Skipping Asset link, it already exists: " + destinationPath);
}
}
#endregion
#region Utility methods
/// <summary>
/// Returns true is the project currently open in Unity Editor is a clone.
/// </summary>
/// <returns></returns>
public static bool IsClone()
{
/// The project is a clone if its root directory contains an empty file named ".clone".
string cloneFilePath = Path.Combine(ProjectCloner.GetCurrentProjectPath(), ProjectCloner.CloneFileName);
bool isClone = File.Exists(cloneFilePath);
return isClone;
}
/// <summary>
/// Get the path to the current unityEditor project folder's info
/// </summary>
/// <returns></returns>
public static string GetCurrentProjectPath()
{
return Application.dataPath.Replace("/Assets", "");
}
/// <summary>
/// Return a project object that describes all the paths we need to clone it.
/// </summary>
/// <returns></returns>
public static Project GetCurrentProject()
{
string pathString = ProjectCloner.GetCurrentProjectPath();
return new Project(pathString);
}
/// <summary>
/// Returns the path to the original project.
/// If currently open project is the original, returns its own path.
/// If the original project folder cannot be found, retuns an empty string.
/// </summary>
/// <returns></returns>
public static string GetOriginalProjectPath()
{
if (IsClone())
{
/// If this is a clone...
/// Original project path can be deduced by removing the suffix from the clone's path.
string cloneProjectPath = ProjectCloner.GetCurrentProject().projectPath;
int index = cloneProjectPath.LastIndexOf(ProjectCloner.CloneNameSuffix);
if (index > 0)
{
string originalProjectPath = cloneProjectPath.Substring(0, index);
if (Directory.Exists(originalProjectPath)) return originalProjectPath;
}
return string.Empty;
}
else
{
/// If this is the original, we return its own path.
return ProjectCloner.GetCurrentProjectPath();
}
}
/// <summary>
/// Returns all clone projects path.
/// </summary>
/// <returns></returns>
public static List<string> GetCloneProjectsPath()
{
List<string> projectsPath = new List<string>();
for (int i = 0; i < MaxCloneProjectCount; i++)
{
string originalProjectPath = ProjectCloner.GetCurrentProject().projectPath;
string cloneProjectPath = originalProjectPath + ProjectCloner.CloneNameSuffix + "_" + i;
if (Directory.Exists(cloneProjectPath))
projectsPath.Add(cloneProjectPath);
}
return projectsPath;
}
/// <summary>
/// Copies directory located at sourcePath to destinationPath. Displays a progress bar.
/// </summary>
/// <param name="source">Directory to be copied.</param>
/// <param name="destination">Destination directory (created automatically if needed).</param>
/// <param name="progressBarPrefix">Optional string added to the beginning of the progress bar window header.</param>
public static void CopyDirectoryWithProgressBar(string sourcePath, string destinationPath, string progressBarPrefix = "")
{
var source = new DirectoryInfo(sourcePath);
var destination = new DirectoryInfo(destinationPath);
long totalBytes = 0;
long copiedBytes = 0;
ProjectCloner.CopyDirectoryWithProgressBarRecursive(source, destination, ref totalBytes, ref copiedBytes, progressBarPrefix);
EditorUtility.ClearProgressBar();
}
/// <summary>
/// Copies directory located at sourcePath to destinationPath. Displays a progress bar.
/// Same as the previous method, but uses recursion to copy all nested folders as well.
/// </summary>
/// <param name="source">Directory to be copied.</param>
/// <param name="destination">Destination directory (created automatically if needed).</param>
/// <param name="totalBytes">Total bytes to be copied. Calculated automatically, initialize at 0.</param>
/// <param name="copiedBytes">To track already copied bytes. Calculated automatically, initialize at 0.</param>
/// <param name="progressBarPrefix">Optional string added to the beginning of the progress bar window header.</param>
private static void CopyDirectoryWithProgressBarRecursive(DirectoryInfo source, DirectoryInfo destination, ref long totalBytes, ref long copiedBytes, string progressBarPrefix = "")
{
/// Directory cannot be copied into itself.
if (source.FullName.ToLower() == destination.FullName.ToLower())
{
Debug.LogError("Cannot copy directory into itself.");
return;
}
/// Calculate total bytes, if required.
if (totalBytes == 0)
{
totalBytes = ProjectCloner.GetDirectorySize(source, true, progressBarPrefix);
}
/// Create destination directory, if required.
if (!Directory.Exists(destination.FullName))
{
Directory.CreateDirectory(destination.FullName);
}
/// Copy all files from the source.
foreach (FileInfo file in source.GetFiles())
{
try
{
file.CopyTo(Path.Combine(destination.ToString(), file.Name), true);
}
catch (IOException)
{
/// Some files may throw IOException if they are currently open in Unity editor.
/// Just ignore them in such case.
}
/// Account the copied file size.
copiedBytes += file.Length;
/// Display the progress bar.
float progress = (float)copiedBytes / (float)totalBytes;
bool cancelCopy = EditorUtility.DisplayCancelableProgressBar(
progressBarPrefix + "Copying '" + source.FullName + "' to '" + destination.FullName + "'...",
"(" + (progress * 100f).ToString("F2") + "%) Copying file '" + file.Name + "'...",
progress);
if (cancelCopy) return;
}
/// Copy all nested directories from the source.
foreach (DirectoryInfo sourceNestedDir in source.GetDirectories())
{
DirectoryInfo nextDestingationNestedDir = destination.CreateSubdirectory(sourceNestedDir.Name);
ProjectCloner.CopyDirectoryWithProgressBarRecursive(sourceNestedDir, nextDestingationNestedDir, ref totalBytes, ref copiedBytes, progressBarPrefix);
}
}
/// <summary>
/// Calculates the size of the given directory. Displays a progress bar.
/// </summary>
/// <param name="directory">Directory, which size has to be calculated.</param>
/// <param name="includeNested">If true, size will include all nested directories.</param>
/// <param name="progressBarPrefix">Optional string added to the beginning of the progress bar window header.</param>
/// <returns>Size of the directory in bytes.</returns>
private static long GetDirectorySize(DirectoryInfo directory, bool includeNested = false, string progressBarPrefix = "")
{
EditorUtility.DisplayProgressBar(progressBarPrefix + "Calculating size of directories...", "Scanning '" + directory.FullName + "'...", 0f);
/// Calculate size of all files in directory.
long filesSize = directory.EnumerateFiles().Sum((FileInfo file) => file.Length);
/// Calculate size of all nested directories.
long directoriesSize = 0;
if (includeNested)
{
IEnumerable<DirectoryInfo> nestedDirectories = directory.EnumerateDirectories();
foreach (DirectoryInfo nestedDir in nestedDirectories)
{
directoriesSize += ProjectCloner.GetDirectorySize(nestedDir, true, progressBarPrefix);
}
}
return filesSize + directoriesSize;
}
/// <summary>
/// Starts process in the system console, taking the given fileName and args.
/// </summary>
/// <param name="fileName"></param>
/// <param name="args"></param>
private static void StartHiddenConsoleProcess(string fileName, string args)
{
var process = new System.Diagnostics.Process();
//process.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
process.StartInfo.FileName = fileName;
process.StartInfo.Arguments = args;
process.Start();
}
/// <summary>
/// starts process with the system shell
/// </summary>
/// <param name="cmdAndArgs"></param>
/// <returns></returns>
private static void StartProcessWithShell(string cmdName, string Args)
{
var process = new System.Diagnostics.Process();
process.StartInfo.UseShellExecute = true;
process.StartInfo.FileName = cmdName;
// process.StartInfo.RedirectStandardError = true;
process.StartInfo.Arguments = Args;
process.Start();
process.WaitForExit(-1);
Debug.Log($"cmd process exiting with code :{process.ExitCode}");
}
#endregion
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 6148e48ed6b61d748b187d06d3687b83
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,131 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
using UnityProjectCloner;
using System.IO;
namespace UnityProjectCloner
{
/// <summary>
/// Provides Unity Editor window for ProjectCloner.
/// </summary>
public class ProjectClonerWindow : EditorWindow
{
/// <summary>
/// True if currently open project is a clone.
/// </summary>
public bool isClone
{
get { return ProjectCloner.IsClone(); }
}
/// <summary>
/// Returns true if project clone exists.
/// </summary>
public bool isCloneCreated
{
get { return ProjectCloner.GetCloneProjectsPath().Count >= 1; }
}
[MenuItem("Tools/Project Cloner")]
private static void InitWindow()
{
ProjectClonerWindow window = (ProjectClonerWindow)EditorWindow.GetWindow(typeof(ProjectClonerWindow));
window.titleContent = new GUIContent("Project Cloner");
window.Show();
}
private void OnGUI()
{
if (isClone)
{
/// If it is a clone project...
string originalProjectPath = ProjectCloner.GetOriginalProjectPath();
if (originalProjectPath == string.Empty)
{
/// If original project cannot be found, display warning message.
string thisProjectName = ProjectCloner.GetCurrentProject().name;
string supposedOriginalProjectName = ProjectCloner.GetCurrentProject().name.Replace("_clone", "");
EditorGUILayout.HelpBox(
"This project is a clone, but the link to the original seems lost.\nYou have to manually open the original and create a new clone instead of this one.\nThe original project should have a name '" + supposedOriginalProjectName + "', if it was not changed.",
MessageType.Warning);
}
else
{
/// If original project is present, display some usage info.
EditorGUILayout.HelpBox(
"This project is a clone of the project '" + Path.GetFileName(originalProjectPath) + "'.\nIf you want to make changes the project files or manage clones, please open the original project through Unity Hub.",
MessageType.Info);
}
}
else
{
/// If it is an original project...
if (isCloneCreated)
{
GUILayout.BeginVertical("HelpBox");
GUILayout.Label("Clones of this Project");
/// If clone(s) is created, we can either open it or delete it.
var cloneProjectsPath = ProjectCloner.GetCloneProjectsPath();
for (int i = 0; i < cloneProjectsPath.Count; i++)
{
GUILayout.BeginVertical("GroupBox");
string cloneProjectPath = cloneProjectsPath[i];
EditorGUILayout.LabelField("Clone " + i);
EditorGUILayout.TextField("Clone project path", cloneProjectPath, EditorStyles.textField);
if (GUILayout.Button("Open in New Editor"))
{
ProjectCloner.OpenProject(cloneProjectPath);
}
GUILayout.BeginHorizontal();
if (GUILayout.Button("Delete"))
{
bool delete = EditorUtility.DisplayDialog(
"Delete the clone?",
"Are you sure you want to delete the clone project '" + ProjectCloner.GetCurrentProject().name + "_clone'? If so, you can always create a new clone from ProjectCloner window.",
"Delete",
"Cancel");
if (delete)
{
ProjectCloner.DeleteClone(cloneProjectPath);
}
}
//Offer a solution to user in-case they are stuck with deleting project
if (GUILayout.Button("?", GUILayout.Width(30)))
{
var openUrl = EditorUtility.DisplayDialog("Can't delete clone?",
"Sometime clone can't be deleted due to it's still being opened by another unity instance running in the background." +
"\nYou can read this answer from ServerFault on how to find and kill the process.", "Open Answer");
if (openUrl)
{
Application.OpenURL("https://serverfault.com/a/537762");
}
}
GUILayout.EndHorizontal();
GUILayout.EndVertical();
}
GUILayout.EndVertical();
//Have difficulty with naming
//GUILayout.Label("Other", EditorStyles.boldLabel);
if (GUILayout.Button("Add new clone"))
{
ProjectCloner.CreateCloneFromCurrent();
}
}
else
{
/// If no clone created yet, we must create it.
EditorGUILayout.HelpBox("No project clones found. Create a new one!", MessageType.Info);
if (GUILayout.Button("Create new clone"))
{
ProjectCloner.CreateCloneFromCurrent();
}
}
}
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: a041d83486c20b84bbf5077ddfbbca37
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,110 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System.Linq;
using UnityProjectCloner;
namespace UnityProjectCloner
{
public class Project : System.ICloneable
{
public string name;
public string projectPath;
string rootPath;
public string assetPath;
public string projectSettingsPath;
public string libraryPath;
public string packagesPath;
public string autoBuildPath;
char[] separator = new char[1] { '/' };
/// <summary>
/// Default constructor
/// </summary>
public Project()
{
}
/// <summary>
/// Initialize the project object by parsing its full path returned by Unity into a bunch of individual folder names and paths.
/// </summary>
/// <param name="path"></param>
public Project(string path)
{
ParsePath(path);
}
/// <summary>
/// Create a new object with the same settings
/// </summary>
/// <returns></returns>
public object Clone()
{
Project newProject = new Project();
newProject.rootPath = rootPath;
newProject.projectPath = projectPath;
newProject.assetPath = assetPath;
newProject.projectSettingsPath = projectSettingsPath;
newProject.libraryPath = libraryPath;
newProject.name = name;
newProject.separator = separator;
newProject.packagesPath = packagesPath;
newProject.autoBuildPath = autoBuildPath;
return newProject;
}
/// <summary>
/// Update the project object by renaming and reparsing it. Pass in the new name of a project, and it'll update the other member variables to match.
/// </summary>
/// <param name="name"></param>
public void updateNewName(string newName)
{
name = newName;
ParsePath(rootPath + "/" + name + "/Assets");
}
/// <summary>
/// Debug override so we can quickly print out the project info.
/// </summary>
/// <returns></returns>
public override string ToString()
{
string printString = name + "\n" +
rootPath + "\n" +
projectPath + "\n" +
assetPath + "\n" +
projectSettingsPath + "\n" +
packagesPath + "\n" +
autoBuildPath + "\n" +
libraryPath;
return (printString);
}
private void ParsePath(string path)
{
//Unity's Application functions return the Assets path in the Editor.
projectPath = path;
//pop off the last part of the path for the project name, keep the rest for the root path
List<string> pathArray = projectPath.Split(separator).ToList<string>();
name = pathArray.Last();
pathArray.RemoveAt(pathArray.Count() - 1);
rootPath = string.Join(separator[0].ToString(), pathArray);
assetPath = projectPath + "/Assets";
projectSettingsPath = projectPath + "/ProjectSettings";
libraryPath = projectPath + "/Library";
packagesPath = projectPath + "/Packages";
autoBuildPath = projectPath + "/AutoBuild";
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: ec8d3a1577179ef44815739178cf75b4
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,15 @@
{
"name": "projectCloner",
"references": [],
"optionalUnityReferences": [],
"includePlatforms": [
"Editor"
],
"includePlatforms": [],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": []
}

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 894a6cc6ed5cd2645bb542978cbed6a9
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,7 +1,6 @@
{
"dependencies": {
"com.boxqkrtm.ide.cursor": "https://github.com/boxqkrtm/com.unity.ide.cursor.git",
"com.hwaet.projectcloner": "https://github.com/hwaet/UnityProjectCloner.git",
"com.unity.collab-proxy": "2.2.0",
"com.unity.feature.2d": "2.0.0",
"com.unity.ide.rider": "3.0.27",

View File

@ -9,13 +9,6 @@
},
"hash": "38fecf55e4fd94ccfe58a92ed8ad1a529ba1694e"
},
"com.hwaet.projectcloner": {
"version": "https://github.com/hwaet/UnityProjectCloner.git",
"depth": 0,
"source": "git",
"dependencies": {},
"hash": "f8c8347af3a144069dffd6120f1c4142f8120891"
},
"com.unity.2d.animation": {
"version": "9.1.3",
"depth": 1,

View File

@ -1,4 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<projectSettings>
<projectSetting name="Google.IOSResolver.VerboseLoggingEnabled" value="False" />
<projectSetting name="Google.PackageManagerResolver.VerboseLoggingEnabled" value="False" />
<projectSetting name="Google.VersionHandler.VerboseLoggingEnabled" value="False" />
<projectSetting name="GooglePlayServices.AutoResolverEnabled" value="False" />
<projectSetting name="GooglePlayServices.PromptBeforeAutoResolution" value="False" />
</projectSettings>

6363
mono_crash.188aff70a4.0.json Normal file

File diff suppressed because it is too large Load Diff

5633
mono_crash.193e95227c.0.json Normal file

File diff suppressed because it is too large Load Diff