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 mrdoktor1974 · Jun 14, 2012 at 07:38 AM · errorwwwflashphpfatal

Getting Fatal Error 2030 using WWW in Flash

I've stumbled upon an error I just can't understand. When doing a WWW to a certain php I get:

 Fatal Error : Error: Error #2030: End of file was encountered.
 at flash.net::URLStream/readBytes()
 at com.unity::UnityNative$/Ext_UrlStream_CopyBytes()
 at com.unity::UnityNative$/_ZN8WWWFlash12DoneCallbackEii()
 at com.unity::UnityNative$/WWWFlashCallbackSize()
 at com.unity::URLStreamHandler/onURLLoaderComplete()

So I stripped the php down to just returning the string "0" and the WWW function to just:

 WWW www = new WWW("http://195.178.163.254/summergames/test.php");
 yield return www;
 print(www.text);

But I'm still getting the same error.

Now to the real weird part. I'm not getting any error when posting to some of our other php's.

Btw, the error only shows when exporting to Flash. Works just fine in the editor.

Loading test.php with URLLoader or URLStream in Flash does not generate the error either.

Any ideas?

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

7 Replies

· Add your reply
  • Sort: 
avatar image
2

Answer by catburton · Jun 19, 2012 at 05:02 PM

Thanks for reporting this. I've raised a bug report for this issue.

In the meantime, you can work around this issue by doing your web request in pure AS3 inside your Unity project:

  • Create an AS3 class in your project which has a function to perform the web request and store the response. Put this class in a folder called ActionScript.

  • Now create a matching class in C# and add the [NotConverted] and [NotRenamed] attributes so that this class will not be converted to AS3 at runtime.

  • In your project, assuming the C#/AS3 classes have the same API, you should be able to create a new instance of this class and use its web request function.

I've hacked together a very quick example (attached) which works for your test.php service. Hopefully you can use this to fix your project.

WWW.zip


WWW.zip (22.8 kB)
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 zXcongducXz · May 07, 2015 at 02:58 AM 0
Share

I need help with these example:

in C#: [NotRenamed] public static string response;

in AS: public static var response : String;

but i need to pass an array to AS:

in C#: public string[] variables;

in AS: public var variables:String[];

==> Unity debug error WWWCaller.as: Syntax error: expecting semicolon before leftbracket.

==> how to fixed?

avatar image
0

Answer by munnaz · Aug 15, 2012 at 07:10 AM

awesome. thanks so much Cat. just having problems when i use the class in that i want to modify the WWWCaller class in actionscript but unity is giving me compile time errors saying

error CS1061: Type WWWCaller' does not contain a definition for DoUserRequest' and no extension method DoUserRequest' of type WWWCaller' could be found (are you missing a using directive or an assembly reference?)

either that or pass a url through in DoWebRequest("http://url").

How do i go about compiling the new WWWCaller class in actionscript within the Unity stuff or should it happen automatically.

thanks for any help

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
0

Answer by munnaz · Aug 15, 2012 at 07:10 AM

ah figured it out

[NotRenamedAttribute] public void DoWebRequest() { //Do nothing in this case. }

needed to put a function within WWWCaller.cs

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
0

Answer by manuelv · Sep 19, 2012 at 10:34 AM

Also Thanks so much too.

Great example WWW

useful because flash unity WWW for WWW.text return null

with your function, it's work

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
0

Answer by Ghisallo · Oct 09, 2012 at 04:07 PM

For the benefit of anyone that is wondering how to pass an url parameter to the DoWebRequest in the Action Script linked above (as I was), you can make the following changes.

In WWWCaller.as:

                 var address:String;
         
                 public function DoWebRequest(address) : void
                 {
                     request = new URLRequest();
                     request.url = address;


In TestWWW.cs:

              #else    
                  WWWCaller wwwCaller = new WWWCaller();
                  wwwCaller.DoWebRequest("http://whatever.etc");

And most importantly, in WWWCaller.cs:

              public void DoWebRequest(string address)

Without the last change, the build will not compile because it seems the whole point of WWWCaller.cs is to act as a placeholder for WWWCaller.as, which Unity will not check for errors. However, if Unity finds errors in WWWCaller.cs, it will not compile. This puzzled me for the longest time, but now it makes complete sense.

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
  • 1
  • 2
  • ›

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

8 People are following this question.

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

Related Questions

Unity Fatal Error guid is uninitialized 1 Answer

WWW Flash: No gzip support? 0 Answers

"Absolute URI is too short" woe 1 Answer

GetThreadContext failed during runtime (not in editor) 0 Answers

Fatal Error! Out of memory. 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