Search Unity

[url]WWW.GetURL[/url]

Discussion in 'Editor & General Support' started by yellowlabrador, Aug 8, 2006.

  1. yellowlabrador

    yellowlabrador

    Joined:
    Oct 20, 2005
    Posts:
    562
    Hello All,

    Is this doable?
    Press gui button on game menu to open help files.

    Code (csharp):
    1.  
    2. var helpPage = WWW.GetURL("file://Applications/nameoffolder/nameofgame/helpfolder/help.pdf");
    3.  
    4. function OnMouseDown()
    5. {
    6.     Application.LoadLevel("helpPage");
    7. }
    8.  
    Just thinking of accessing a help file in pdf or doc format stored in a folder inside the game folder where the game.app is located.

    Am I making sense?

    Thanks,
    Ray
     
  2. NicholasFrancis

    NicholasFrancis

    Joined:
    Apr 8, 2005
    Posts:
    1,587
    That won't work. Loadlevel only loads a Unity level.

    Instead you want to use the OS to open it. Try this code:

    Code (csharp):
    1.  
    2. var filePath = Application.dataPath + "/Manual.html";   // Or .pdf or whatever
    3.  
    4. switch(Application.platform) {       
    5.     case RuntimePlatform.WindowsPlayer:
    6.         System.Diagnostics.Process.Start(filePath);
    7.         break;
    8.     default:
    9.         System.Diagnostics.Process.Start(string.Format("open \"{0}\"",filePath));
    10.     break;
    11. }
    12.  
    Note: This won't work from the web player....
     
  3. yellowlabrador

    yellowlabrador

    Joined:
    Oct 20, 2005
    Posts:
    562
    Sweet,
    Thanks,

    Ray