
Learning C# by Developing Games with Unity 3D Beginner's Guide
By :

We could create a regular C# class for this, but we want to be able to assign some values in Unity's Inspector, so we'll create a Unity C# Script instead. There are times when you will want to use the Inspector, and other times, when assigning values in code is better.
To start, we are going to create three variables to store the images used for the three splash screens in BeginState
, WonStates
, and LostStates
.
By now, you should know how to create a C# Script in Unity or in MonoDevelop. From now on, you should simply create the script using whichever is most convenient at the time.
In the Scripts
folder, create a new C# Script named GameData
, containing the following code:
using UnityEngine; using System.Collections; public class GameData : MonoBehaviour { public Texture2D beginStateSplash; public Texture2D lostStateSplash; public Texture2D wonStateSplash; void Start () { } void Update () { } }
Attach this GameData
script...
Change the font size
Change margin width
Change background colour