Posts Tagged ‘Texture’

Unity: Scaling Pixel Art

Click here to read Unity: Scaling Pixel Art

This Unity post explains how to prepare images and set the Texture Importer settings to correctly render pixel art in Unity3D. So, this post covers how the different Texture Importer settings affects the pixel art textures in 3D models and in the game’s graphical user interface (GUI).

(more…)

Unity: Scaling the GUI based on the screen resolution

Click here to read Unity: Scaling the GUI based on the screen resolution

As hinted by other posts, here, you will find how to properly scale the GUI elements based on screen resolution. As one may have noticed, Unity doesn’t scale the GUI elements based on the screen resolution, requiring a script to do the job, which is explained in this post. I will assume that the reader already knows how to create and render GUI elements in Unity using the MonoBehaviour’s OnGUI() function and GUISkin objects.

The best way to explain how to properly scale a GUI element is through an example. That said, for this post, let’s assume that we wanted a yellow rectangle to be rendered at the top left and bottom right corners of the screen, like this: (more…)

Unity: Creating a simple billboard

Click here to read Unity: Creating a simple billboard

Sometimes, when creating a game, there is the need to use a billboard. In the Unity game engine there is no billboard rendering component, and that’s why this post is going to explain one of the options to do so, it’s advantages and disadvantages. It’s not going to require a single line of code, but it’s not going to be the most optimized option either. At the end of the post a Unity project with all the game objects and components configured here is available for download.

To make a billboard in Unity, there is basically three different options: (more…)

Unity: How to use a GUI Texture to play fullscreen videos

Click here to read Unity: How to use a GUI Texture to play fullscreen videos

Warning: this tutorial only works with Unity Pro because the free version doesn’t come with video playback support. The code was created and tested with Unity version 3.3. It won’t work for versions 2.6 and below (requires some adaptation).

This Unity post explains how to set up a GUI Texture at the Unity editor and the code necessary to play a fullscreen video, that can be used for the studio logo animation at the beginning of the game, the game’s intro or any other video that needs to take the whole screen. It also explains how to properly scale the video based on the screen dimensions. At the end of the post, a Unity project featuring all the code explained here is available for download.

(more…)

Unity: How to create a GUI Sprite Sheet – Part 3

Click here to read Unity: How to create a GUI Sprite Sheet – Part 3

The final part of a series that explains how to create a GUI Sprite Sheet in Unity. This post will focus on explaining how the code works. For those who haven’t read the first and second parts, please do before going any further. As most post series in this website, there is a download with everything that had been explained at the end of the post.

With all images and the GUI Skin already set at the Unity Editor, now we just need some code to render the GUI on the screen. The following script correctly renders separately each element from the sprite sheet, and it’s attached to the Main Camera:

(more…)