TheDeveloperBlog.com

Home | Contact Us

C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML

Unity UI

Unity UI with Introduction, Installing, GameObject, First Unity Project, Unity 2D, Sprite Unity, Loops, If Statement, Data Types, Swith Statements, Unity UI, Unity Asset Store etc.

<< Back to UNITY

Unity UI

Unity UI (User Interface) is used to create a user interface in your game or application.

The workflow for designing Unity UI follows a slightly different path than the one we have been going through so far. For starters, UI elements are not standard GameObjects and can't be used as such. UI elements are designed differently; UI elements are designed differently; a menu button that looks correct in a 4:3 resolution may look stretched or distorted in a 16:9 resolution if not set upright.

In Unity, we cannot place the UI elements directly on the scene. They are always located as children of a special GameObject called the Canvas.

UI Canvas

The UI Canvas is like a drawing sheet for UI elements on the scene, where all UI elements will render. When you create a UI element without an existing canvas will automatically generate one.

UI Canvas acts as the master of all UI elements on the screen. Because of that, all UI elements are required to be the child game object of the canvas game object.

To add the canvas in your scene right, click on the Scene name or Main Camera from the Hierarchy tab and select GameObject -> UI -> Canvas.

Unity UI

Canvas Components

Let's see the canvas components:

Unity UI

Rect Transform

This is the top component of the canvas gameObject. It has many new properties that a standard GameObject's transform does not have.

This is because while a normal GameObject's Transform describes an imaginary point in 3D space, a RectTransform defines an imaginary rectangle. This means we need other properties for defining exactly where the rectangle is, how big it is, and how it is oriented.

Unity UI

Canvas Component

Canvas is the master component that holds a couple of universal options as to how the UI is drawn.

The first property Render Mode defines the method that is used to draw the canvas onto the Game's view.

Unity UI

Canvas Scalar

The canvas scalar component is a set of options that allows you to adjust the scale and appearance of the UI elements in a more definitive way.

Unity UI

Graphics Raycaster

The Graphics Raycaster component deals primarily with raycasting (link to Unity Documentation for Raycasting) the UI elements and ensuring user-initiated events like clicks and drags work correctly.

Unity UI
Next TopicUnity UI Button




Related Links:


Related Links

Adjectives Ado Ai Android Angular Antonyms Apache Articles Asp Autocad Automata Aws Azure Basic Binary Bitcoin Blockchain C Cassandra Change Coa Computer Control Cpp Create Creating C-Sharp Cyber Daa Data Dbms Deletion Devops Difference Discrete Es6 Ethical Examples Features Firebase Flutter Fs Git Go Hbase History Hive Hiveql How Html Idioms Insertion Installing Ios Java Joomla Js Kafka Kali Laravel Logical Machine Matlab Matrix Mongodb Mysql One Opencv Oracle Ordering Os Pandas Php Pig Pl Postgresql Powershell Prepositions Program Python React Ruby Scala Selecting Selenium Sentence Seo Sharepoint Software Spellings Spotting Spring Sql Sqlite Sqoop Svn Swift Synonyms Talend Testng Types Uml Unity Vbnet Verbal Webdriver What Wpf