• 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 Bartimaeuso · Nov 27, 2014 at 09:58 PM · browser

How can I access a file from my browser game when that file is stored on the same web server.

Hi all! I am currently making a browser game demo, I'm almost finished but there is one last thing I can't seem to get to work. The game contains some dialogue trees that the player navigates via gui buttons. The dialogue within these buttons is pulled from a JSON file that I have stored on my local machine in the Assets folder of the project. Right now I am just using a stream reader to read the json file as a string and pushing it through the SimpleJSON extension. This does not work when I publish the game to the web as the JSON file is not uploaded. I was wondering if any one had a simple way to access files from a browser game that are stored within the same spot of the webserver (Maybe a simple url containing datapath or something?) I've tried a few things like using WWW and setting it to the url and using yield to return a string but I couldn't get it to work. If any one knows a decent solution that would be great. I really just need a way to read the file and convert its contents into a string that I can then load up into my JSON object within the program.

Thanks in advance! (Sorry for what I am sure is a ton of grammatical errors, always been terrible at it. ^_^)

Comment
Add comment · Show 7
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 bubzy · Nov 27, 2014 at 10:01 PM 0
Share

you can press enter twice when writing to put something on a separate line :P

like

this

avatar image Bartimaeuso · Nov 27, 2014 at 10:13 PM 0
Share

Not sure why I would want to do that, but

thanks

for

the

advice

:D

avatar image bubzy · Nov 27, 2014 at 10:49 PM 0
Share

because your question is so damned hard to read.

avatar image Bartimaeuso · Nov 27, 2014 at 10:54 PM 0
Share

Well I'm not about to double space my entire question and make it even longer than it is because some people can't handle a single spaced paragraph.

avatar image bubzy · Nov 27, 2014 at 10:56 PM 0
Share

best way to ask for help ever.

Show more comments

1 Reply

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

Answer by unimechanic · Nov 28, 2014 at 04:06 PM

From the description of your problem, this is the information that you need:

http://docs.unity3d.com/ScriptReference/WWW-text.html

http://docs.unity3d.com/ScriptReference/Application-absoluteURL.html

Comment
Add comment · Show 1 · 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 Bartimaeuso · Nov 29, 2014 at 12:54 AM 0
Share

Awesome! Thanks for the reply I will give these a shot!

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

Browser to unity communication 2 Answers

Get o Post method without open browser 1 Answer

Unity plugin for chromebook 3 Answers

BCE0043 + BCE0044 Error! Please help! 1 Answer

Application.ExternalEval("window.open('" "') not working in Safari browser 2 Answers


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