O'Reilly logo

Unity 4 Game Development HOTSHOT by Jate Wittayabundit

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating the UserData and Hiscore scripts

In the first section, we will create the UserData script, which will collect the username and score. This script will inherit from the IComparable<T> interface, which is a custom comparison method in the .NET library that a value type or class implements to create a type-specific comparison method to order instances. This class will have the CompareTo() function, which will be used to sort users by their score. Then, we will add the UserData object in the UIHiscore script and set up the input text field for the player's name.

Note

For more information about the IComparable<T> interface, visit the following links:

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required