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 RescuerRus · Apr 09, 2014 at 03:48 PM · errorpackage

Specific error

Hello guys, i need your help again. I've found this package, which allows to implement a simple leaderboard. The thing is that i'm getting errors(see attachments), the whole code seems right, i simply don't get what's wrong with it. Any help is invaluable.

 using UnityEngine;
 using System.Collections;
 
 public class dreamloLeaderBoard : MonoBehaviour {
     
     string dreamloWebserviceURL = "http://dreamlo.com/lb/";
     
     public string privateCode = "";
     public string publicCode = "";
     
     string highScores;
 
     
     public struct Score {
         public string playerName;
         public int score;
         public int seconds;
         public string shortText;
     }
     
     public static dreamloLeaderBoard GetSceneDreamloLeaderboard()
     {
         GameObject go = GameObject.Find("dreamloLeaderboard");
         
         if (go == null) return null;
         
         return go.GetComponent<dreamloLeaderBoard>();
     }
     
     public void AddScore(string playerName, int totalScore)
     {
         StartCoroutine(AddScoreWithPipe(playerName, totalScore));
     }
     
     public void AddScore(string playerName, int totalScore, int totalSeconds)
     {
         StartCoroutine(AddScoreWithPipe(playerName, totalScore, totalSeconds));
     }
     
     public void AddScore(string playerName, int totalScore, int totalSeconds, string shortText)
     {
         StartCoroutine(AddScoreWithPipe(playerName, totalScore, totalSeconds, shortText));
     }
     
     // This function saves a trip to the server. Adds the score and retrieves results in one trip.
     IEnumerator AddScoreWithPipe(string playerName, int totalScore)
     {
         playerName = Clean(playerName);
         
         WWW www = new WWW(dreamloWebserviceURL + privateCode + "/add-pipe/" + WWW.EscapeURL(playerName) + "/" + totalScore.ToString());
         yield return www;
         highScores = www.text;
     }
     
     IEnumerator AddScoreWithPipe(string playerName, int totalScore, int totalSeconds)
     {
         playerName = Clean(playerName);
         
         WWW www = new WWW(dreamloWebserviceURL + privateCode + "/add-pipe/" + WWW.EscapeURL(playerName) + "/" + totalScore.ToString()+ "/" + totalSeconds.ToString());
         yield return www;
         highScores = www.text;
     }
     
     IEnumerator AddScoreWithPipe(string playerName, int totalScore, int totalSeconds, string shortText)
     {
         playerName = Clean(playerName);
         shortText = Clean(shortText);
         
         WWW www = new WWW(dreamloWebserviceURL + privateCode + "/add-pipe/" + WWW.EscapeURL(playerName) + "/" + totalScore.ToString() + "/" + totalSeconds.ToString()+ "/" + shortText);
         yield return www;
         highScores = www.text;
     }
     
     IEnumerator GetScores()
     {
         highScores = "";
         WWW www = new WWW(dreamloWebserviceURL +  publicCode  + "/pipe");
         yield return www;
         highScores = www.text;
     }
     
     public void LoadScores()
     {
         StartCoroutine(GetScores());
     }
 
     
     public string[] ToStringArray()
     {
         if (this.highScores == "") return null;
         
         string[] rows = this.highScores.Split(new char[] {'\n'}, System.StringSplitOptions.RemoveEmptyEntries);
         return rows;
     }
     
     public Score[] ToScoreArray()
     {
         string[] rows = ToStringArray();
         if (rows == null) return null;
         
         int rowcount = rows.Length;
         
         if (rowcount <= 0) return null;
         
         Score[] scoreList = new Score[rowcount];
         
         for (int i = 0; i < rowcount; i++)
         {
             string[] values = rows[i].Split(new char[] {'|'}, System.StringSplitOptions.RemoveEmptyEntries);
             
             Score current = new Score();
             current.playerName = values[0];
             current.score = 0;
             current.seconds = 0;
             current.shortText = "";
 
             if (values.Length > 1) current.score = CheckInt(values[1]);
             if (values.Length > 2) current.seconds = CheckInt(values[2]);
             if (values.Length > 3) current.shortText = values[3];
             
             scoreList[i] = current;
         }
         
         return scoreList;
     }
     
     
     
     // Keep pipe and slash out of names
     
     string Clean(string s)
     {
         s = s.Replace("/", "");
         s = s.Replace("|", "");
         return s;
         
     }
     
     int CheckInt(string s)
     {
         int x = 0;
         
         int.TryParse(s, out x);
         
         return x;
     }
     
 }

[2]: /storage/temp/24984-screenshot.jpg

screenshot.jpg (46.9 kB)
Comment
Add comment · Show 9
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 RescuerRus · Apr 09, 2014 at 03:54 PM 0
Share

Just to notice: all the scripts are quite big, so i haven't uploaded them here.

avatar image KiraSensei · Apr 09, 2014 at 04:16 PM 0
Share

You don't need to post the whole code, we only need dreamlo$$anonymous$$erBoard.cs, and especially lines 1 to 105 (it is specifically written in the error message...)

avatar image RescuerRus · Apr 09, 2014 at 04:34 PM 0
Share

eh. Whatever :) Upd.

avatar image RescuerRus · Apr 09, 2014 at 05:58 PM 0
Share

Any ideas ?

avatar image thomasindustry · Apr 09, 2014 at 08:58 PM 0
Share

Which lines are 105 and 111? I don't think the lines numbers in the post are matching up with the ones in your editor.

Show more comments

1 Reply

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by Mikael-Gyth · Apr 10, 2014 at 09:36 AM

Try checking if

 if(string.IsNullOrEmpty(this.highScores)) return null;

instead of

 if (this.highScores == "") return null;

on line 90.

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 RescuerRus · Apr 10, 2014 at 12:13 PM 0
Share

Well, i've checked and error disappeared. But still i'm not getting the system to work. Probably it's my mistake, have to check it.

avatar image RescuerRus · Apr 10, 2014 at 12:17 PM 0
Share

Solved. Thanks a bunch.

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

24 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 avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Error on package.json: Unexpected token " at 1:1 2 Answers

Unable to Use HDRP? Failed to Decompress? 0 Answers

Same Package Manager problem for 2020.1.16 exit code: 216 1 Answer

NuGet Package not working (Algorand) 1 Answer

Errors with Entity Component System packages at the editor start 0 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