Search Unity

Server Side Highscores tutorial, Unknown identifier: 'Md5'

Discussion in 'Editor & General Support' started by iLoveChocolate, Apr 6, 2010.

  1. iLoveChocolate

    iLoveChocolate

    Joined:
    Apr 6, 2010
    Posts:
    63
    Dear Unity Users

    Recently I have tried Unity Wiki "HighScore" tutorial.

    I found some issue with the HighScore.
    1. Assets/Scripts/HSController.js(13,14): BCE0005: Unknown identifier: 'Md5'.

    I could not find Md5 class in the Unity API.
    Does any one knows how to solve this please?

    Thank you in advance
     
  2. fallingbrickwork

    fallingbrickwork

    Joined:
    Mar 16, 2009
    Posts:
    1,072
  3. iLoveChocolate

    iLoveChocolate

    Joined:
    Apr 6, 2010
    Posts:
    63
  4. joehamilton

    joehamilton

    Joined:
    Apr 24, 2010
    Posts:
    10
    It says – "Best placed in your static-only utility class."
    Where can I find the "static-only utility class"?

    And if I try and use the .js code I get the following error:

    Assets/md5functions.js(6,34): BCE0023: No appropriate version of 'System.Text.UTF8Encoding.GetBytes' for the argument list '(Object)' was found.

    Any ideas on getting either of these to work?

    Thanks!
     
    Last edited: Nov 18, 2010
  5. andeeeee

    andeeeee

    Joined:
    Jul 19, 2005
    Posts:
    8,768
    The C# code is just an isolated function but in practice, it would need to be added to a class to make it work. The author of the wiki script was just suggesting that, rather than make a new class for the function, you would more likely want to add it to an existing class.

    The JS code will work if you change the top line of the function to this:-
    Code (csharp):
    1. static function Md5Sum(strToEncrypt: String)
    Specifying the type of the parameter explicitly gives the compiler enough information to work out the rest for itself.
     
  6. dre38w

    dre38w

    Joined:
    Nov 18, 2009
    Posts:
    137
    I got an error with that script and I don't know what it's doing.

    Assets/Standard Assets/Scripts/md5functions.js(9,34): BCE0004: Ambiguous reference 'GetBytes': System.Text.Encoding.GetBytes(char[]), System.Text.Encoding.GetBytes(String).

    I put String in here - static function Md5Sum(strToEncrypt) - Because it didn't have it but when I place String in there it gives me several other warnings. Not errors just warnings. I'm not sure what's going on. And I don't really want to mess with this, it being a default script that is communicating with several other scripts. Any ideas?
     
  7. dre38w

    dre38w

    Joined:
    Nov 18, 2009
    Posts:
    137
    Nevermind. I got it. Just some obsolete code in a different default script. Had to change "data" to "text" in a couple other scripts.