O'Reilly logo

Creating E-Learning Games with Unity by David Horachek

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

Making the ScorePlate active

Let's create a simple script to update the text field of this score as shown in the following screenshot:

Making the ScorePlate active

The following script will update the text field in the upper-right corner of the screen so that it reflects the score stored in PlayerData:

  1. Switch to the MAIN scene. Create a new script, and name it scoreScript.cs.
  2. Attach an instance of this script to the score GameObject.
  3. In the start method of this script, find the GameObject named Player, and then store a reference to the PlayerData component on this script.
  4. The score script needs to update a member of the GUIText GameObject score, so the update loop that this script ...

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