Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Set Unity app as default app

Discussion in 'Editor & General Support' started by honkzor, Dec 27, 2019.

  1. honkzor

    honkzor

    Joined:
    Jun 21, 2016
    Posts:
    3
    Hello!

    Not sure if this is the right place for my question, found nothing on the subject with google.

    I am planning on writing a small PDF viewer app using Unity (with some special funtions and possibly multiplatform). I can´t find any information on this specific thing though:

    If I work for example in the Windows file explorer, I can select "open with" and select my Unity App (.exe). This should send a message with full path and filename to my app.

    Now how do I make my app listen for this path and filename? Is this even possible in Unity?

    Best regards
    Henrik Karlsson
     
  2. julian_cruz

    julian_cruz

    Unity Technologies

    Joined:
    Nov 21, 2016
    Posts:
    16
    Hi @honkzor, you might try using C# to achieve that.
    In the following link, you may find how to get the full path and filename.
    Also, there is a way to invoke "Open With" using C# as well. You just need to check out at this link, and also this one, in which this is invoked from a Process.
    Then you could get the result by using the output from the process like the following example.

    Keep in mind that every OS has its own way to invoke Open With.

    Let me know if you need any further help.
     
  3. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    14,446