Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Getting Started with Unity 5

You're reading from   Getting Started with Unity 5 Leverage the power of Unity 5 to create amazing 3D games

Arrow left icon
Product type Paperback
Published in May 2015
Publisher
ISBN-13 9781784398316
Length 184 pages
Edition 1st Edition
Tools
Arrow right icon
Author (1):
Arrow left icon
Dr. Edward Lavieri Jr. Dr. Edward Lavieri Jr.
Author Profile Icon Dr. Edward Lavieri Jr.
Dr. Edward Lavieri Jr.
Arrow right icon
View More author details
Toc

Scripting with C# in Unity


Let's get our feet wet by jumping right in and start scripting. The following are the steps to create a new script in Unity using C#:

  1. Launch Unity.

  2. Open the game project.

  3. From the top menu, navigate and select Assets | Create | C# Script.

  4. You'll see the script in the Project view and you'll be in script name edit mode. Name the script testScript. We'll delete this script when we are finished:

    The script is now visible in the Inspector view.

  5. In the Project view, under Assets, double-click on the script. This will launch MonoDevelop and provide you with the ability to edit the script:

  6. Add the following line of code in MonoDevelop in line 8:

    print("Hello Little Farmer Colt!");
  7. Your script should now match the following screenshot:

  8. In the MonoDevelop top menu, navigate and select File | Save or File | Save All.

  9. Close the MonoDevelop window.

  10. Review the script using the Inspector view to ensure that your changes were saved, as shown in the following screenshot:

  11. Click on the Main...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime