Quantcast
Channel: Questions in topic: "webrequest"
Viewing all articles
Browse latest Browse all 387

ERROR SAME REQUEST WITHIN A SECOND: 4

$
0
0
I am trying to upload a high score to dreamlo and am getting an error. "ERROR SAME REQUEST WITHIN A SECOND: 4 UnityEngine.MonoBehaviour:print(Object) HighScoreManager:FormatHighscores(String) (at Assets/Scripts/HighScoreManager.cs:68) d__10:MoveNext() (at Assets/Scripts/HighScoreManager.cs:52) UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)" using System.Collections; using UnityEngine; using UnityEngine.Networking; public class HighScoreManager : MonoBehaviour { const string privateCode = ""; const string publicCode = ""; const string webURL = "http://dreamlo.com/lb/"; DisplayHighScore highscoreDisplay; public Highscore[] highscoresList; static HighScoreManager instance; void Awake() { highscoreDisplay = GetComponent(); instance = this; } public static void AddNewHighscore(string username, int score) { instance.StartCoroutine(instance.UploadNewHighscore(username, score)); } IEnumerator UploadNewHighscore(string username, int score) { WWW www = new WWW(webURL + privateCode + "/add/" + UnityWebRequest.EscapeURL(username) + "/" + score); yield return www; if (string.IsNullOrEmpty(www.error)) { print("Upload Successful"); DownloadHighscores(); } else { print("Error uploading: " + www.error); } } public void DownloadHighscores() { StartCoroutine("DownloadHighscoresFromDatabase"); } IEnumerator DownloadHighscoresFromDatabase() { WWW www = new WWW(webURL + publicCode + "/pipe/"); yield return www; FormatHighscores(www.text); highscoreDisplay.OnHighscoresDownloaded(highscoresList); } void FormatHighscores(string textStream) { string[] entries = textStream.Split(new char[] { '\n' }, System.StringSplitOptions.RemoveEmptyEntries); highscoresList = new Highscore[entries.Length]; for (int i = 0; i < entries.Length; i++) { string[] entryInfo = entries[i].Split(new char[] { '|' }); string username = entryInfo[0]; int score = int.Parse(entryInfo[1]); highscoresList[i] = new Highscore(username, score); print(highscoresList[i].username + ": " + highscoresList[i].score); } } } public struct Highscore { public string username; public int score; public Highscore(string _username, int _score) { username = _username; score = _score; } } I have tried looking for a solution and have not found anything.

Viewing all articles
Browse latest Browse all 387

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>