object


This function is used for UI buttons mostly but sometimes we need it in game specs. It is implemented easily with mouse enter-exit listeners. We can change color of an object with renderers. Create a cube object and attach this script to it. At first, define 2 colors for standard […]

Change Color on Hover (Mouseover) – Unity3D (C#)


Drag Object with Mouse – Unity3D (C#) It’s too easy and quick to drag an object with mouse. Just use OnMouseDown() and OnMouseDrag() functions. [crayon-6752363f1608e002729885/] Save script and attach to object. That’s all!   ©Coffee Break Codes – Drag Object with Mouse – Unity3D (C#)

Drag Object with Mouse – Unity3D (C#)


Move Object with Lerp – Unity3D (C#) You can use Lerp function to move an object automatically. You just need start and end points. Object moves from start to end in time. You can assign start point and end point manually in script or with mouse click. These points may […]

Move Object with Lerp – Unity3D (C#)



Mouse Click on Game Object – Unity3D (C#) There are two ways to perform click function on a game object: 1- Create and attach a script to the target object. Write this function in it. [crayon-6752363f37c91451075993/]   2- You can use Physics.Raycast to detect target with ray. You must write […]

Mouse Click on Game Object – Unity3D (C#)


Character Control with Keyboard – Unity3D (C#) I will show you 2 ways to move your character with keyboard. Create a cube named “Char” and create a script named “Movement”. You can attach this script to Char object but we won’t.  Lets create an object before Start() function: [crayon-6752363f3f225534916804/] character is […]

Character Control with Keyboard – Unity3D (C#)