Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by BawsAnimations · Aug 01, 2013 at 05:54 PM ·

GUI Button to open an external document? HELP!!!!

I am trying to make a button in-game which would open my Readme Text document located in the data folder. How do I go about doing this?

My goal is to create a OnGUI function with a GUI button. On clicking the button I want an external text document to open. I have done this with internet URLS which work fine.

Help please? =)

P.S. : It will be VERY helpful if you could post a finished code that I can use =)

Comment
Add comment · Show 4
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Jamora · Aug 01, 2013 at 06:11 PM 1
Share
  • for asking for code. You need to learn to program if you're serious about your game. I also think it's rude.

avatar image BawsAnimations · Aug 03, 2013 at 08:02 AM 2
Share

Excuse me? Jamora if you can't help, don't bother commenting, ITS NOT RUDE TO AS$$anonymous$$ FOR CODE SA$$anonymous$$PLES!

$$anonymous$$any people recieve/ask for code samples in the unity answers. Please stop posting unnecessary and rude comments on my post.

avatar image Jamora · Aug 03, 2013 at 08:34 AM 1
Share

Asking for a code snippet to demonstrate a solution is ok, whereas asking for a complete, working, finished script is not.

avatar image BawsAnimations · Aug 03, 2013 at 08:58 AM 1
Share

I was asking for a code snippet, just because I said finished code it doesnt mean that I asked for an entire script, I was just asking for the portion about the GUI Button. Please read carefully.

3 Replies

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by BawsAnimations · Aug 03, 2013 at 08:56 AM

Ok guys here's how I fixed this problem :

 if(GUILayout.Button ("ReadMe"))
 {
 Application.OpenURL("Game_Data\\ReadMe.txt");
 }

I used the Path, but instead of the entire path I started it from only the data folder so that anyone that downloads my game will be able to open the Text Doc.

Cheers =)

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image fafase · Aug 03, 2013 at 09:10 AM 0
Share

$$anonymous$$ake sure it works on build.

avatar image BawsAnimations · Aug 03, 2013 at 09:19 AM 0
Share

It does, after building, just have to place the txt doc in the data folder

avatar image
1

Answer by roojerry · Aug 01, 2013 at 06:02 PM

Check out Process.Start() examples. There is an example for opening text files

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image BawsAnimations · Aug 03, 2013 at 08:02 AM 0
Share

Okay thanks I will look into it.

avatar image BawsAnimations · Aug 03, 2013 at 08:05 AM 0
Share

Thanks but how would I go about making this in Javascript? Please reply =)

avatar image
1

Answer by fafase · Aug 03, 2013 at 08:09 AM

You can use http://docs.unity3d.com/Documentation/ScriptReference/Application.OpenURL.html

Comment
Add comment · Show 4 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image BawsAnimations · Aug 03, 2013 at 08:17 AM 0
Share

Sorry but that's completely different. Im not looking to open a URL like a website or anything. Im trying to open a text document which is on my computer. So for example I have a readme.txt document. On clicking a GUI button ingame, I want it to open the readme.txt document. It is VERY SI$$anonymous$$ILAR to Application.OpenURL, but I need something that opens files.

avatar image fafase · Aug 03, 2013 at 08:20 AM 0
Share

Have you tried to pass the path of your file?

avatar image fafase · Aug 03, 2013 at 08:22 AM 0
Share

Actually, I realized we are using :

 Process.Start(Path.Combine(Application.dataPath,nom_fichier));

but url works as well, but I think we had issue with the build. So use the other.

avatar image BawsAnimations · Aug 03, 2013 at 08:55 AM 0
Share

Ok I think I fixed the problem, I changed the URL so that it only opens a document in the data folder of the game.(where i placed the txt)

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

17 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Player model doesn't stay on ground 1 Answer

Why when I hit play the game is paused? 1 Answer

Help me please im stuck here Assets/MeleeSystem.js(12,38): UCE0001: ';' expected. Insert a semicolon at the end. 1 Answer

I open my project and I found that everything's gone?! 2 Answers

the textures look bad 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges