O'Reilly logo

HoloLens Beginner’s Guide by Jason Odom

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

The breakdown of a Unity C# class

Let's look at the class we created in this chapter and break it down into easily digestible parts.

Firstly, here is what a basic Unity C# class looks like, broken down to its bare essentials:

using UnityEngine; 

namespace HoloLensBeginnersGuide 
{ 
    public class LaunchBall : MonoBehaviour 
    {    //member variables and properties belong here. 

        void Start() 
        { 

        } 
        void Update() 
        { 
        } 
     }   
} 

Now, we will want to compare that to LauchBall.cs. A Unity C# class consists of the following:

  • Using declarations: The using directive is primarily used for including namespaces in the application. Defaults in Unity are UnityEngine and System.Collections:
        using UnityEngine; 
        using System.Collections; 
  • Namespace: Namespace definitions ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required