C# Addendum
The C# version of the DisappearMe
script is nearly identical to the JavaScript version. There are just a few differences between the way in which JavaScript and C# scripts are set up.
using UnityEngine; using System.Collections; public class DisappearMeCSharp : MonoBehaviour { // Use this for initialization void Start () { } // Update is called once per frame void Update () { renderer.enabled = false; } }
Notice that the C# script has two using
statements at the top. This is because there are thousands of collections of code and keywords that you can tap into with C#, and if we assume that every project needs to have access to every nook and cranny of the C# language, we'll wind up with a massive final file! The using
keyword tells Unity ...
Get Unity 4.x Game Development by Example Beginner's Guide 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.