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
0
Question by ruwhan · Jun 15, 2011 at 04:05 AM · webplayerwww

WWW Error in Web Player

I've got some problem with Unity3d WWW class.

I'm trying to get string from an URL, it works fine in unity editor, but when I build into Web Player, it does not working. its like the coroutine always trying to get data (I'm not set the time out), but got nothing, "WWW.error" properties is also null, if I use "while(www.isDone){}" it will be blocking (never enter into the scene/level). Can anyone help?

here are the coroutine code:

 public IEnumerator SubmitLogin()
 {        
     
     WWW download = new WWW("http://targetdomain/index.php?op=login&username=user&password=pwd");
     
     yield return download;

     // this is will be blocking forever in web player
     //while(!download.isDone){}    
     if(download == null)
     {
         Debug.Log("download data is null");
     }
     else
     {
         //_sessionId = download.text;
         Debug.Log(download.text);
     }
 
     
     if(download.error != null)
     {
         Debug.Log("Download error" + download.error);
         _sessionId = "SESSION EMPTY, " + download.error;
     }
 }
Comment
Add comment · Show 1
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 ruwhan · Jun 15, 2011 at 08:53 AM 0
Share

PS: Now I get the error message, the error message was "rejected because no crossdomain.xml policy file was found". It was weird, since I already have that file in a correct place.

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by zwacky · Jun 15, 2011 at 09:15 AM

methods of return type IEnumerator shouldn't return any values as you did with

 yield return download;

the usual snippet would be

 yield download; // only proceed if download is complete

also make sure that your crossdomain.xml is accessible like http://targetdomain/crossdomain.xml with the right entries like this template (whereas everything is allowed)

 <cross-domain-policy>
     <allow-access-from domain="*"/>
     <site-control permitted-cross-domain-policies="master-only"/>
 </cross-domain-policy>
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 ruwhan · Jun 15, 2011 at 09:40 AM 0
Share

Thanks Zwacky.

Yes you were correct I must use "yield download;" if I'm using javascript, but my code above is using C#.

I have already put crossdomain.xml in correct place, in this case htdocs folder of XA$$anonymous$$PP. but still the result is "error because no crossdomain.xml policy file found". Is this a bug?

avatar image zwacky · Jun 15, 2011 at 09:54 AM 0
Share

omg my bad, brainlagging at the c#. i assume, that both - your webplayer and your page - is not in a private network but reachable for everyone?

this error would imply that it is reachable for your game, but since it's on a different domain, you have to access his crossdomain.xml which seems not to be present on that host (most possibly you already knew this, but just for the record). the error is related to your web configuration, not to unity.

i once used WWW classes along with crossdomain.xml and i didn't have any trouble.

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

2 People are following this question.

avatar image avatar image

Related Questions

Can't complete http POST request using webplayer build settings even after changing WWW security emulation 1 Answer

Is HttpWebRequest supposed to work in Web Builds or not? 1 Answer

I cannot load an asset in web player with instantiate 1 Answer

embed google maps into unity 3d 4 Answers

Is WWW.movie supposed to be this slow? 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