Skip to Content
Mastering UI Development with Unity
book

Mastering UI Development with Unity

by Dr. Ashley Godbold
April 2018
Beginner content levelBeginner
468 pages
11h 7m
English
Packt Publishing
Content preview from Mastering UI Development with Unity

UnityEngine.UI namespace

A namespace is a collection of classes. When you include a namespace in your class, you are stating that you want to access all the variables and methods (functions) in your class. Namespaces are accessed at the top of a script with the using keyword.

By default, all new C# scripts include the System.Collections, System.Collections.Generic, and UnityEngine namespaces. To access the properties of UI elements via code, you must first use the UnityEngine.UI namespace.

Therefore, at the top of your C# script, you will need to include the following line to signify that you want to use the UnityEngine.UI namespace:

using UnityEngine.UI;

Without using the namespace, any variable type related to UI elements will be colored ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Game Development with Unity for .NET Developers

Game Development with Unity for .NET Developers

Jiadong Chen
Unity UI Cookbook

Unity UI Cookbook

Francesco Sapio

Publisher Resources

ISBN: 9781787125520Supplemental Content