Search Unity

Question Call script from project on another pc (same LAN)

Discussion in 'Scripting' started by aitorolazabal17, Feb 22, 2024.

  1. aitorolazabal17

    aitorolazabal17

    Joined:
    Nov 27, 2023
    Posts:
    31
    Hi,
    I'm trying to send a scene to another pc, call a script from the project on that other pc and have it return the result. I have done the sending scene part, following this link . I store the scene on the Assets folder of the project on the other pc.

    Now Im trying to trigger the script on that other project, executing this code

    Code (CSharp):
    1. string command = "\\\\DESKTOP-1OH17TP\\path-to-Unity.exe -batchmode -quit -projectPath \\\\DESKTOP-1OH17TP\\path-to-project -executeMethod CreateAssetBundles.BuildAllAssetBundles";
    2.  
    3. Process process = Process.Start("powershell.exe", command);
    4. process.WaitForExit();
    5. process.Close();
    The result I get is that it opens the unity hub in my pc, but thats not what I am looking for. I have tried putting the path to the other pcs powershell but the result is the same.

    What is the right way to call to that script?
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,705
    The first check is if you're building this with IL2CPP because the Process class was NOT implemented in IL2CPP.

    After that it's just debugging. Make a simple executable you know you have rights to execute, you know it can find path-wise, and see if it runs.
     
  3. aitorolazabal17

    aitorolazabal17

    Joined:
    Nov 27, 2023
    Posts:
    31
    I had both projects on the same pc before and it worked, now I'm trying to do it in separate ones. It would store the scene on the other projects folder, call the script and generate a bundle.

    Now I get to store the scene on the other pc on the projects folder, but I am not getting to execute the script from the other project, it just opens the unity hub.
     
  4. CodeSmile

    CodeSmile

    Joined:
    Apr 10, 2014
    Posts:
    5,899
    The user account may be logged out. That opens the Hub, for you to sign in.

    If you use the same user account on both machines, it's very likely that if you work on the primary machine the user on the remote machine gets logged out and vice versa. You may have to create a separate free account for the remote machine. You'd still have to expect to get logged out every now and then and manually sign in again.