Posts Tagged ‘Unity3D’

Posts that contain information about Unity3D game engine.

Unity3D: Programming a machine gun – Part 2

Click here to read Unity3D: Programming a machine gun – Part 2

This is the second and last post of this series that explains how to code a machine gun in Unity3D. The first post explained how to make the automatic firing mechanism, and this one will focus on how to set-up the machine gun, the bullet and explain the code that makes it all work. Also, a Unity3D project with all the source code discussed on the series is available for download at the end of the post.

So, let’s start by setting the machine gun. The 3D model of the gun can be any one, you don’t even have to create a 3D model at all, it is possible to use Unity3D’s cubes and other primitives. The only thing that one must know is that the muzzle of the gun must be a completely separate element. This is crucial when making the gun at an external 3D modeling application such as 3D Studio Max, Blender or XSI. (more…)

Unity3D: Programming a machine gun – Part 1

Click here to read Unity3D: Programming a machine gun – Part 1

This is the first of two posts that will explain how to program a machine gun at the Unity3D game engine. This post will focus on coding the element that defines a weapon of this type: continuous automatic firing. It will show two different ways to achieve this behavior: one based on the Invoke() method call, and the other based on Unity3D’s coroutines. As any other post series in this website, a Unity3D project with all the source code will be available at the last post of the series.

All code in this post will be in C#, but for those who don’t use it, a JavaScript version of the code will be available for download at the end of the post.

(more…)

Unity3D: Non-rectangular GUI buttons – Part 3

Click here to read Unity3D: Non-rectangular GUI buttons – Part 3

This is the last post of this series, which explains how to create non-rectangular GUI buttons for Unity3D games. If you haven’t read any of the other posts yet, it is highly recommended that you take a look at part one and part two before going any further.

So, let’s start from where the second post left: we already have our Unity3D scene set up with the 3D hit test model already imported and placed inside the scene. All we have to do now is import the PNG images and make then appear as a GUI element. To do that, just drag and drop then somewhere inside the Project tab. After the images are inside Unity3D, create a GUISkin by right clicking an empty space in this same tab and select Create->GUISkin as shown: (more…)

Unity3D: Non-rectangular GUI buttons – Part 2

Click here to read Unity3D: Non-rectangular GUI buttons – Part 2

This post series explains how to create non-rectangular shaped buttons in Unity3D. This is the second part, so if you missed the first one, it is almost required that you read it here. The first post explained how to set up the 2D image, and then, make a 3D model out of it to serve as hit test area. This 3D model is necessary because we are going to use Unity3D’s Raycast collision detection do make the buttons.

This post will explain all the steps necessary to prepare the Unity3D scene to receive the non-rectangular GUI code.

(more…)

Unity3D: Non-rectangular GUI buttons – Part 1

Click here to read Unity3D: Non-rectangular GUI buttons – Part 1

Unity3D is a great tool to make games, but sometimes we encounter some limitations like the hit test area of the GUI buttons: they all have to be rectangular. This post series shows how to overcome this limitation letting you create GUI buttons that can have any shape.

It will cover it all, since the initial operations required to export the button’s PNG file from the image editing software, to the code at Unity3D. So, the post series will be divided into 3 parts, that will cover all the necessary steps.

In this first post, everything that must be done outside Unity3D will be explained. You will need a image editing software (like Photoshop or GIMP) and a 3D modeling software such as 3D Studiomax or Blender.

(more…)