- Home /
Unity wont launch PDF when built, works in editor
Hi,
I'm try to open a pdf from a unity standalone application. I've used the following methods:
Process.Start(Application.dataPath + "//PDFs//" + fileName + ".pdf");
&
Application.OpenURL(Application.dataPath + "//PDFs//" + fileName + ".pdf");
Both work fine in the editor but doesn't work when i build the application.
This may be a permission issue with android. I'm not quite sure. $$anonymous$$aybe you could try embedding the pdf into unity with some kind of asset container. $$anonymous$$aybe the "openURL" is limited to only actual URL's, to deny apps form accessing other locations outside its environment?
Answer by jahroy · Dec 02, 2011 at 08:18 PM
Have you read the documentation about how the value of Application.dataPath changes for each platform?
If you're in the Editor, it will return the Assets folder.
If you're doing a Standalone build, it returns something different.
Thanks, Not have a chance to try it till monday but sounds like that will be the problem. Silly me.
Not sure if your PDF will get moved to these places from the Assets folder automatically (sounds like it won't).
If you're wondering how to get it there (automatically) you can use a PostProcessBuildPlayer script:
http://unity3d.com/support/documentation/$$anonymous$$anual/Build%20Player%20Pipeline.html
Your answer
![](https://koobas.hobune.stream/wayback/20220613061717im_/https://answers.unity.com/themes/thub/images/avi.jpg)