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 jurion · Apr 13, 2012 at 11:12 AM · webplayerwebservice

Unity WebPlayer and WWW object

Hello,

I'm working on a project involving Unity WebPlayer and some Soap web services. Here is a part of my code:

 string request = CurrentMode.GetInstance().WebServiceUrl+ "/someFunction?";
         WWW www = new WWW(request);
         Debug.Log("waiting for web service");
         while (!www.isDone) ;
         Debug.Log("web service done ! ");
         if (www.error != null)
         {
             Debug.Log("Error downloading: " + www.error);
         }
         else
         {
             var result = JsonReader.Deserialize<MyClass[]>(www.text);

It's working without a problem in Unity editor and standalone executable. But it doesn't working from Unity WebPlayer.

There is my crossdomain.xml

 <?xml version="1.0"?>
 <cross-domain-policy>
   <allow-access-from domain="*"/>
 </cross-domain-policy>

What am I doing wrong ?

Edit: a little precision: The line

 Debug.Log("waiting for web service");

Is executed, but

 Debug.Log("web service done ! ");

Never. It only occurs when running in WebPlayer.

Edit 2 : This is a log from WebPlayer I stripped unimportant parts (like the load of assemblies)

Input initialized.

desktop: 1920x1200 59Hz; virtual: 1920x1200 at 0,0 Platform assembly: C:\Users\doroshen\AppData\LocalLow\Unity\WebPlayer\mono\3.x.x\Data\lib\System.Core.dll (this message is harmless) Init UnityEngine.Debug:Internal_Log(Int32, String, Object) UnityEngine.Debug:Log(Object) EditorManager:Awake()

(Filename: C:/BuildAgent/work/b0bcff80449a48aa/Runtime/ExportGenerated/WebPlayer/UnityEngineDebug.cpp Line: 43)

Platform assembly: XXXXXXX\AppData\LocalLow\Unity\WebPlayer\player\3.x.x\Data\lib\CrossDomainPolicyParser.dll (this message is harmless)

 waiting for web service

The first Debug.log ^^

UnityEngine.Debug:Internal_Log(Int32, String, Object) UnityEngine.Debug:Log(Object) EditorManager:loadAiroports() EditorManager:Awake()

(Filename: C:/BuildAgent/work/b0bcff80449a48aa/Runtime/ExportGenerated/WebPlayer/UnityEngineDebug.cpp Line: 43)

Comment
Add comment · Show 6
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 Tseng · Apr 13, 2012 at 11:12 AM 0
Share

Is the webservice url the same domain as your webplayer?

avatar image GuyTidhar · Apr 13, 2012 at 11:19 AM 0
Share

Some features that work in a certain platform, might not work on another. Check this out: http://unity3d.com/support/documentation/ScriptReference/$$anonymous$$onoCompatibility.html

avatar image GuyTidhar · Apr 13, 2012 at 11:21 AM 0
Share

Oh. And even worse then that, from experience, some stuff that are listed as compatible, might not be compatible.

avatar image jurion · Apr 13, 2012 at 11:39 AM 0
Share

Both are lunched from localhost.

avatar image dibonaj · Apr 13, 2012 at 12:22 PM 0
Share

Are you getting any kind of errors, or is it just hanging there?

Show more comments

2 Replies

· Add your reply
  • Sort: 
avatar image
2

Answer by jurion · Apr 13, 2012 at 03:56 PM

Ok I'm going to answer my own question, maybe it will helps someone else.

I was trying to simulate a "synchronous" call; because I didn't want my application to do anything before all data is loaded. (It's not a game, but an application for Intranet, so wait time is not really an issue)

It is not possible in WebPlayer. The line

 while (!www.isDone) ;

Crushes WebPlayer plugin. Si to use a www class in WebPlayer you must use

 StartCoroutine 

for asynchronous calls.

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 Tseng · Apr 13, 2012 at 04:14 PM 0
Share

$$anonymous$$ark the question as answered please (the "checkbox below the up/down buttons), so that the question won't appear under "Unanswered" tab anymore

avatar image Chris_Hagan · Jul 25, 2012 at 07:22 AM 0
Share

$$anonymous$$agnificent! I don't have the rep to upvote you, so I'm giving you a long winded thanks ins$$anonymous$$d. Considering that the plugin can easily have crashed before your latest log message comes to light, this can be VERY misleading as to where the problem is co$$anonymous$$g from. It all needs to move to chained coroutines ins$$anonymous$$d, and then it works fine.

avatar image
0

Answer by josodo · Apr 26, 2012 at 05:36 PM

Hi! I'm trying to consume a SOAP web service from unity and i have tried several ideas unsuccessfully. Could you please, bring me some light in this sense? Thanks!

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

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

9 People are following this question.

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

Related Questions

ocupo una solocion a este problema en windows 8 con unity web player 0 Answers

A node in a childnode? 1 Answer

How to upload a local file via the web player? 1 Answer

Having trouble publishing my Unity Game on Facebook 1 Answer

Webplayer throwing FTP errors as popups 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