-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating

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

Let's create another script with a variable and a method, and attach it to the Main Camera, then have LearningScript
communicate with it:
In Unity, create another C# Script and name it TalkToMe
.
Make a public
string
variable named hereItIs
.
Assign some text to hereItIs
.
Make a public
method named MakeMeTalk()
.
Have MakeMeTalk()
output some text to the Console.
Attach MakeMeTalk()
to the Main Camera. Now the code should look something like this:
Modify LearningScript
to retrieve the TalkToMe
Component.
Modify LearningScript
to retrieve the data in hereItIs.
Modify LearningScript
to call the MakeMeTalk()
method. Now the code snippet should look as follows:
Save your scripts.
Click on Play in Unity.
Here's the output:
The LearningScript
Component code retrieved a variable and called a method on the TalkToMe
Component. Let's follow the code flow with these two Components.
An analysis of the code shown in the previous...
Change the font size
Change margin width
Change background colour