Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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
1
Question by Scott 2 · Mar 01, 2010 at 10:54 PM · guiwebplayerserver

How do I show a txt file from my server in GUI?

Hi everyone this is doing my head in, I am new to unity3d (a week or so) and the more I get into it not only the more I love but the harder and harder. ;-)

Anyway I have server side php files that save to txt to display the total visitors as well as the current number visiting, how can I show this within a GUI environment like a HUD.

I have tried loads of different ways and I just can't get my head around it.

Thanks

Comment
Add comment
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

3 Replies

· Add your reply
  • Sort: 
avatar image
5

Answer by Motionreactor · Mar 02, 2010 at 04:14 AM

Luckily the Unity team have made this really simple:

var dataString: String; var url = "http://www.mysite.com/data.txt";

function Start () { // Start a download of the given URL var www : WWW = new WWW(url);

 // Wait for download to complete
 yield www;

 // assign data from URL to string
 dataString = www.data; 

}

function OnGUI() { GUI.Label(Rect(100, 100, 140, 20), dataString); }

Reference: http://unity3d.com/support/documentation/ScriptReference/WWW.html

Comment
Add comment · 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
1

Answer by Ashkan_gc · Mar 02, 2010 at 07:11 AM

you can use WWW class to download any resource from the web. you can just get the data and parse/show it yourself or tell unity that it's an audio file and tell it to play the audio. also you can tell it's a video or a package of assets that unity can use in a game. this is one of the powerful features of unity. the code example of MotionReactor is good and complete. also you can use the WWWForm class to send form data to a form in a webpage and submit the form. you can even data fields like images or movies or ...

Comment
Add comment · 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
-1

Answer by Scott 2 · Mar 03, 2010 at 12:05 AM

Thank you everyone

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 Motionreactor · Mar 03, 2010 at 03:27 PM 0
Share

use 'add comment' to add a comment, rather than creating an answer.

avatar image AngryAnt ♦♦ · Mar 04, 2010 at 09:49 AM 1
Share

Also, if a provided answer fully covers your question, please mark it as accepted by clicking the check mark next to it. That helps people looking for the same answer in the future find it quicker.

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

No one has followed this question yet.

Related Questions

How to detect if mouse is over GUI element in Web Player? 0 Answers

Unauthorized use of Caching API in webplayer 0 Answers

WWW fails in Webplayer but not Standalone 0 Answers

How to take a Screenshot that includes GUI 1 Answer

Click button on html page to spawn an object into unity webplayer game 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