Reader small image

You're reading from  Unity for Architectural Visualization

Product typeBook
Published inSep 2013
Reading LevelIntermediate
PublisherPackt
ISBN-139781783559060
Edition1st Edition
Languages
Tools
Right arrow
Author (1)
Stefan Boeykens
Stefan Boeykens
author image
Stefan Boeykens

Stefan Boeykens is a Belgian architect-engineer. Starting out as a professional architect in several offices, he returned to KU Leuven in 2000, at the Department of Architecture, for teaching and research, completing his PhD on Building Information Modelling in 2007. Stefan is an experienced researcher with a variety of IT skills. Aside from teaching BIM, he is mainly working as senior Innovation and BIM manager for the Belgian D-Studio, focusing on BIM middleware and consultancy. He is a frequent speaker at BIM-related events and is actively involved in BIM standardization groups, including CEN/TC 442 (Europe) and Belgian Technical Committees. He is father of three boys and enjoys musical composition, reading, cycling and life-long-learning.
Read more about Stefan Boeykens

Right arrow

Basic heads-up-display with a custom GUI


When we explained the use of GUIText and GUITexture components in Chapter 4, Promenade Architecturale, they were static. This is fine for a fixed logo, but not when you need dynamic information. You can script these components, but they are not the most efficient ones to use. This is shown in the following code:

public Texture2D someTexture;
...
guiText.text = "Hello";
guiTexture.texture = someTexture;

An alternative is the use of the Unity Graphical User Interface (GUI) classes. To display a GUI inside a script in Unity, use the OnGUI() event. This runs independently of the regular Update() cycle. Inside this event, you can display buttons, text labels, sliders, panels, scroll areas, textures, and toggle switches.

We illustrate this with a simple GUI script that displays the name of the trigger we enter, as shown in the following screenshot, which also displays some feedback in the console.

The following steps will show how to set up a simple scene...

lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Unity for Architectural Visualization
Published in: Sep 2013Publisher: PacktISBN-13: 9781783559060

Author (1)

author image
Stefan Boeykens

Stefan Boeykens is a Belgian architect-engineer. Starting out as a professional architect in several offices, he returned to KU Leuven in 2000, at the Department of Architecture, for teaching and research, completing his PhD on Building Information Modelling in 2007. Stefan is an experienced researcher with a variety of IT skills. Aside from teaching BIM, he is mainly working as senior Innovation and BIM manager for the Belgian D-Studio, focusing on BIM middleware and consultancy. He is a frequent speaker at BIM-related events and is actively involved in BIM standardization groups, including CEN/TC 442 (Europe) and Belgian Technical Committees. He is father of three boys and enjoys musical composition, reading, cycling and life-long-learning.
Read more about Stefan Boeykens