Posts Tagged ‘Button’

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.


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.


Android: touchscreen ‘swipe’ movement detection

Click here to read Android: touchscreen ‘swipe’ movement detection

This post explains how to code a simple swipe screen movement detection that can be used to control characters and other objects on an Android game or any other application.

All this code is written inside the View class, so open it up and let’s get to it. The first thing we will have to do is to create four different variables: one pair will store where the screen was touched, and the other one will be used to store the difference between the location where the screen has been pressed and where the screen has been released. Create this variables and assign zero to all of then, like this: (more…)

Android: Changing the ‘back’ button behaviour

Click here to read Android: Changing the ‘back’ button behaviour

Sometimes, when programming Android applications, there is the need to assign another behavior for the ‘Back’ button that isn’t the default one. Although not recommended, there are some cases that changing the ‘Back’ button behavior is necessary, such as to avoid accidentally finishing the current Activity.

For example, a text editor, should confirm if the user really wants to quit without saving the current changes, or a game, that check if it is the player’s intention to forfeit the current game session.

So, to start changing the ‘Back’ button, behavior, you need to override the onKeyDown() method and than check if the desired button has been pressed: (more…)

Page 4 of 41234