Search Unity

Execute function by Command Line not working

Discussion in 'Formats & External Tools' started by james_cg, Jun 24, 2020.

  1. james_cg

    james_cg

    Joined:
    Nov 13, 2019
    Posts:
    17
    I want to add my config files to unity with jenkins, and use unity commands to generate meta files, so I used shell commands like this ( Python language):

    Code (CSharp):
    1. command = [UNITY_PATH, "-batchmode -projectPath", PROJECT_PATH, "-executeMethod Editor_Test.TestReimportScript"]
    2. subprocess.call(command, shell=True)
    Code (CSharp):
    1.     static void TestReimportScript()
    2.     {
    3.         string pathRsc = "xxx";
    4.         AssetDatabase.ImportAsset(pathRsc, ImportAssetOptions.ImportRecursive);
    5.         UnityEngine.Debug.Log(" =Done= ");
    6.     }
    After I add some new files, shell commands works fine but no new meta files were created, " =Done= " also not printed.

    So, Anyone knows why ImportAsset has no effect ?