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
1
Question by tikyorules · Sep 10, 2013 at 07:28 PM · androidmobile

unity 3D - android platform] problem on server side highscore get method on actual android device.

so i have this android project that implements a simple online leader-board, i used the Server Side high-score from the Unify Community Wiki link text and tried to applied it on an android project.

here is the situation: when i run the project on Unity itself, both the set and get method for the database is working, simply put i can post new scores on to the database server and i can grab the scores from the database server and show it on the Leader-board scene using GUIText.

now when i run the project on an actual Android device e.g. an android tablet or a smart phone, i can surely set new scores to the database server, but somehow the get method won't work on it, i can't seem to show the scores from the server on the leader-board scene when the game is running on an actual device...

its seems like if the game is running on an actual android device, it can write on the server but it can't read, meaning i can post scores but i can't just display them.

but when i run the same game on Unity in PC it can post scores and also display them...

file size for images is limited so I'll just post links on two images:

this one is a picture of the leader-board scene of the game running on an actual android device, see how the scores won't appear but i can post new scores on the server using the device, but it won't display them, post method is working but get is not working... link text

this one is a screenshot of the leader-board scene of the android project running in unity, it displays the score, as well as you can also post new scores on to the database server, both post and get is working. link text

this is the code for my getmethod script:

 var getScoreUrl = "ewoogaming.x10host.com/display.php";
 
 function Awake()
 {
     GetScores();
 }
 
 function GetScores()
 {
     var hs_get = WWW(getScoreUrl);
     yield hs_get;
     
     if(hs_get.error)
     {
         print("Error getting scores: " + hs_get.error);
     }
     else
     {
         guiText.text = hs_get.text;
     }
 }

this is the code for my diplay.php, side note i had to change the user and password for the database and the database name.

 <?php
     // Send variables for the MySQL database class.
     $database = mysql_connect('localhost', 'myUser', 'myPass') or die('Could not connect: ' . mysql_error());
     mysql_select_db('myDB') or die('Could not select database');
  
     $query = "SELECT * FROM `scores` ORDER by `score` DESC LIMIT 10";
     $result = mysql_query($query) or die('Query failed: ' . mysql_error());
  
     $num_results = mysql_num_rows($result);  
  
     for($i = 0; $i < $num_results; $i++)
     {
          $row = mysql_fetch_array($result);
          echo $row['name'] . "\t" . $row['score'] . "\n";
     }
 ?>

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

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

15 People are following this question.

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

Related Questions

sensor temperature android 0 Answers

whole animation not being played 0 Answers

Unity 3d app make my andorid phone heat 1 Answer

How to run unity app like a "live wallpaper" on android? 0 Answers

Simple Unity3d Facebook Integration? 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