In this series we will focus on all things Unity. We will start with creating the ability to move and resize user interface elements so that we can create user customizable interfaces and then we will see what we would find interesting to learn about after that.
#4 Confining the Draggable Behavior to a View Box
In this article we will finally be able to drag our panel around the screen. Once we are able to do that we will create the ability to confine the panel either to the entire screen or a specified portion of it using a view box.
#3 Adding a User Interface Camera
In this article we will focus on adding a new camera to our scene that will be reposible for only displaying our user interface. We will then need to adjust the culling mask of our main camera so that it does not display the UI. For everything to work correctly it will be very important for us to make sure that our UI camera is placed in the correct position and in order to do that we will create a small script and create our first custom editor in order to be able to interact with it.
#2 Follow Pointer Coroutine
In this article we will focus on creating the code for a coroutine that we can use to allow our gameobject to follow the users cursor around when it is being dragged. To facilitate this we will see how to determine where the pointer is relative to the rect transform of the object that will be dragging around the screen.
#1 Draggable Behavior Pointer Events
In this article we will do a little setup and then spend the majority of time focusing on dealing with user input, in our case both pointer up and pointer down, as it relates to our draggable behavior. We will first see how we wire up our event handlers using the Unity editor and once we have a better understanding of that process we will proceed to wire them up programatically so that we do not have to do the manual steps everytime we add our draggable behavior to an object.