unity多开脚本

使用方法

  • 找个空文件夹
  • 新建两个脚本
  • 配置bat脚本的路径
  • 双击bat脚本

python脚本

import os
from posixpath import dirname
import subprocess
import sys

targetProjectPath = sys.argv[1]

tempBatFile = open("temp.bat", "w")

existDirs = [f for f in os.listdir(os.getcwd()) if os.path.isdir(f)]
for subDir in existDirs:
    if os.path.exists("{}/{}".format(os.getcwd(), subDir)):
        os.remove(subDir)
targetDirs = [f for f in os.listdir(targetProjectPath) if os.path.isdir("{}/{}".format(targetProjectPath, f))]
print(targetDirs)
for subDir in targetDirs:
    if subDir == "obj" or subDir == "Temp" or subDir == "Logs":
        continue
    path = "mklink /J {} {}\{}\n".format(subDir, targetProjectPath, subDir)
    tempBatFile.write(path)

tempBatFile.close()

subprocess.call([r'temp.bat'])
print("complete")

bat脚本

python mul_unity_project.py "your project path"
pause

猜你喜欢

转载自blog.csdn.net/ak47007tiger/article/details/121408045