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 Bladynator · Sep 09, 2015 at 07:07 PM · webplayerdatabase

Webplayer<->Database

My game won't connect to the database when it's build into the web player. I does work when it's just an .exe.

I used WWW to connect to a .php script to find and access my database.

  • I HAVE the crossdomain.xml script in my root.

  • I HAVE my domain in the editor.

  • I checked everything so it is the same ( so no http and https errors )

I have no idea what i could be doing wrong and it's driving me nuts..

Comment
Add comment · Show 21
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 Bladynator · Sep 14, 2015 at 05:20 PM 0
Share

EDIT: I can get data from the database from the webplayer now, but i can't send any data. I use this methode to send the new data to my database ( note that this DOES work in the editor and pc version )

 public static void SendScore(string name, int score)
     {
         string URI = "myURLisHIDDEN";
         string myParameters = "name=" + name + "&score=" + score;
         using (WebClient wc = new WebClient())
         {
             wc.Headers[HttpRequestHeader.ContentType] = "application/x-www-form-urlencoded";
             string HtmlResult = wc.UploadString(URI, myParameters);
         }
     }
avatar image sys12 · Sep 15, 2015 at 01:31 PM 0
Share

Is there any errors in the log files?

avatar image Bladynator sys12 · Sep 15, 2015 at 01:37 PM 0
Share

Just checked it again, but the log files are empty.

avatar image sys12 Bladynator · Sep 15, 2015 at 01:40 PM 0
Share

Empty?

Try to restart your unity and run your project again. There should be something inside even if it is working properly.

Are you checking the correct directory? It is run inside editor or it is built to webplayer? http://docs.unity3d.com/$$anonymous$$anual/LogFiles.html

Show more comments
Show more comments
avatar image sys12 sys12 · Sep 15, 2015 at 02:23 PM 0
Share

Yes, but I'm not sure if it is able to solve this issue.

I think your problem looks like this one

http://answers.unity3d.com/questions/473829/unity-serializer-w-web-player-how-to-save-object-t-1.html

I'm not sure what the headers in your code do.

That's what in my code public string POST(string url, NameValueCollection dictionary) { try { using (var client = new WebClient()) { var response = client.UploadValues(url, dictionary); return Encoding.UTF8.GetString(response); } } catch (Exception ex) { Debug.Log("Bad url: " + ex.$$anonymous$$essage); throw; } } I haven't tested the code for a while though, I think it worked before.

avatar image sys12 sys12 · Sep 15, 2015 at 02:23 PM 0
Share
 public string POST(string url, NameValueCollection dictionary)
     {
         try
         {
             using (var client = new WebClient())
             {
                 var response = client.UploadValues(url, dictionary);
                 return Encoding.UTF8.GetString(response);
             }
         }
         catch (Exception ex)
         {
             Debug.Log("Bad url: " + ex.$$anonymous$$essage);
             throw;
         }
     }
Show more comments
Show more comments
avatar image Bladynator · Sep 15, 2015 at 02:58 PM 0
Share

NotSupportedException: http://www.hidden.nl/file.php at System.Net.WebRequest.GetCreator (System.String prefix) [0x00000] in :0

at System.Net.WebRequest.Create (System.Uri requestUri) [0x00000] in :0

at System.Net.WebClient.GetWebRequest (System.Uri address) [0x00000] in :0

at System.Net.WebClient.SetupRequest (System.Uri uri) [0x00000] in :0

at System.Net.WebClient.SetupRequest (System.Uri uri, System.String method, Boolean is_upload) [0x00000] in :0

at System.Net.WebClient.UploadDataCore (System.Uri address, System.String method, System.Byte[] data, System.Object userToken) [0x00000] in :0

at System.Net.WebClient.UploadData (System.Uri address, System.String method, System.Byte[] data) [0x00000] in :0 Rethrow as WebException: An error occurred perfor$$anonymous$$g a WebClient request. at System.Net.WebClient.UploadData (System.Uri address, System.String method, System.Byte[] data) [0x00000] in :0

at System.Net.WebClient.UploadData (System.Uri address, System.Byte[] data) [0x00000] in :0

at System.Net.WebClient.UploadData (System.String address, System.Byte[] data) [0x00000] in :0

at System.Net.WebClient.UploadString (System.String address, System.String data) [0x00000] in :0

at (wrapper remoting-invoke-with-check) System.Net.WebClient:UploadString (string,string)

at OnlineHighScore.SendScore (System.String name, Int32 score) [0x00000] in :0

at GameOver.OnGUI () [0x00000] in :0

(Filename: Line: -1)

0 Replies

· Add your reply
  • Sort: 

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Web Player and database 1 Answer

Is it possible to dynamically add .fbx files to a unity project from a database during run time 1 Answer

Why can't I build Web Player in Unity while I have no problems with building standalone versions? 2 Answers

How to connect to oracle databases for webplayers 0 Answers

Game External Files on the Unity Web Player? 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