Challenge

As an added challenge, you can turn this into a die simulator. Try on your own to have the script display a random number from 1-6. You can, instead of displaying text, display an image of a die face. Also, see if you can display the image and store the random number corresponding to the die face for reference.

You can also try changing the seed to a number of your choice. If you play the scene with a constant number, you will get the same result every time. Try different numbers for different results. This is the benefit of the seed value; even though we are introducing a bit of randomness to our game, we have a way to control it. We will explore the seed value further in a later chapter.

Get Procedural Content Generation for Unity Game Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.