Search Unity

Win32 il2cpp Process.Start not work

Discussion in 'Windows' started by shuaizhao, Jul 6, 2018.

  1. shuaizhao

    shuaizhao

    Joined:
    Jul 6, 2018
    Posts:
    3
    Unity2018.1.6f1
    Win32 IL2Cpp Process.Start(run_path, url); not work.
    Mone is fine.
    output_log print this :
    System.ComponentModel.Win32Exception: Success
    System.Diagnostics.Process.Start_shell
     
  2. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    Can we get a bug report on this?
     
  3. shuaizhao

    shuaizhao

    Joined:
    Jul 6, 2018
    Posts:
    3
  4. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    Thanks, we will take a look.
     
  5. ImpossibleRobert

    ImpossibleRobert

    Joined:
    Oct 10, 2013
    Posts:
    531
    Has this ever been fixed? I am on 2019.3 right now and get the same error. This is really bad for any automation out of a Unity app and currently a blocker for me. Are there any workarounds known?
     
  6. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,938
    We've not implemented process creation or management in managed code with IL2CPP. I don't expect that we will implement it soon, so I would recommend either using Mono scripting backend or using your own native library to handle processes.
     
  7. ImpossibleRobert

    ImpossibleRobert

    Joined:
    Oct 10, 2013
    Posts:
    531
    Thanks for the quick reply. I have switched to Mono for my Desktop builds and that works indeed nicely but it's a pity that this is yet another property my custom build chain will have to consider between platform builds. Would be really great to have this aligned :)
     
    Mese96 likes this.
  8. TJHeuvel-net

    TJHeuvel-net

    Joined:
    Jul 31, 2012
    Posts:
    838
    @JoshPeterson so starting a process from within an IL2CPP build is not possible, and thats a feature?
     
  9. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,938
    Correct, IL2CPP does not currently support starting of processes.
     
    TJHeuvel-net likes this.
  10. TJHeuvel-net

    TJHeuvel-net

    Joined:
    Jul 31, 2012
    Posts:
    838
    Ok; thanks for the quick response.

    Luckily we could get around it, in case anyone wants to start a steam process you can also call OpenUrl with a `rungameid` url.
     
    Stolf likes this.
  11. ImpossibleRobert

    ImpossibleRobert

    Joined:
    Oct 10, 2013
    Posts:
    531
    Is it planned to be possible in the foreseeable future?
     
  12. codestage

    codestage

    Joined:
    Jul 27, 2012
    Posts:
    1,931
    That was a huge surprise for me when I've got the Win32Exception: Success in unity 2019 LTS while trying to start a process from the IL2CPP build xD

    Hope it will be implemented in the future.
     
  13. xucian

    xucian

    Joined:
    Mar 7, 2016
    Posts:
    846
    What's so challenging about implementing this feature? can't we at least execute a shell command and get the stdout?

    I have to run "/bin/bash -c 'df -BM --output=avail "." | tail -n 1'" so I can get the correct free disk space, as no other tools are available for linux. But not being able to start a process seems a bit shocking
     
  14. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,938
    To be honest, starting a process is pretty easy, but the .NET Process API is pretty rich and complex, so implementing the entire thing is not trivial.
     
    codestage and xucian like this.
  15. xucian

    xucian

    Joined:
    Mar 7, 2016
    Posts:
    846
    I see, so it's an all or nothing thing. Makes sense, but I think we'd be happy with just a few features implemented, and some throwing NotImplementedException (instead of cryptic native errors).
    There are 2 guys on asset store each selling a partial implementation of this as an asset. I think it's in everyone's interest to approach them and take over their work, for fair price.
    The one I chose doesn't seem to support the Process.StandardOutpout.ReadToEnd(). Might be something you could start with.
     
    codestage likes this.
  16. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,938
    Although I would like to do this, to be completely transparent, I don't think it is something that we will implement soon. With other priorities in the mix, this one has not risen to the top in a while, and I don't expect it to.
     
  17. seacharge

    seacharge

    Joined:
    May 25, 2018
    Posts:
    5
    This information should be added to "Scripting Restrictions" in the docs.
     
    xucian and codestage like this.
  18. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,938
    Good point! I'll add it there.
     
  19. RocketRidah

    RocketRidah

    Joined:
    Jul 8, 2017
    Posts:
    1
    Thanks for adding it to the 2023 docs Josh. On behalf of dozens of devs who'll run into this downstream from today, any chance it gets added to previous supported versions ?

    It sucks to be looking for documentation for the version of Unity you use and have restrictions more up to date on the latest version but not the version we're on, and to have to crawl through forums and google search to look for it. I understand if updating legacy version docs is frowned upon - but supported versions should be up for grabs.
     
    xucian likes this.
  20. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,938
    Thanks, this is a really great point. I'm not sure why I did not back port the documentation when I made this change. I'll go ahead and do that now.
     
    codestage likes this.
  21. xucian

    xucian

    Joined:
    Mar 7, 2016
    Posts:
    846
    by any chance, was there any advancement in exposing this function in il2cpp?
     
  22. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,938
    No, we've not implemented this for IL2CPP yet. I don't expect that we will implement it soon.
     
    xucian likes this.