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-58d5e93b151e9646713851/] Save script and attach to object. That’s all!   ©Coffee Break Codes – Drag Object with Mouse – Unity3D (C#)

Drag Object with Mouse – Unity3D (C#)


Save and Load Game – Unity3D (C#) People thinks that save and load functions are a little bit complicated in game development. We will use 2 types of game saving and game loading in Unity3D and you will get that it is not as complex as you think. We use […]

Save and Load Game – Unity3D (C#)


 Add Animation – Unity3D Animations are used for animating any movement or stand position of an object. Some game objects in asset store have their own animation as you know but you can add animation even for a single cube. You can change rotation or position of a 3D object to […]

Add 2D Animation – Unity3D



Move Object to Mouse Click Position – Unity3D (C#) No matter 2D or 3D, we use same method to move an object to mouse click position. We need to get mouse click position on ground or whatever, and move object to this position. Create a plane and a cube. We […]

Move Object to Mouse Click Position – 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#)


Move, Zoom and Rotate Camera – Unity3D (C#) Move: It is same as moving character. Just use keyboard buttons and move camera with a float speed variable. [crayon-58d5e93b166cd151985678/]   Zoom: To zoom with scroll wheel, we need scroll wheel input to zoom in or zoom out. [crayon-58d5e93b166d5519893626/]   Rotate: I will […]

Move, Zoom and Rotate Camera – Unity3D (C#)



Add Sound Effect – Unity3D (C#) You can add sound effects for all actions in your project. For example, when your character jumps or collides another object or just click on a button, you can call your sound effect. At first, add an “Audio Source” to your scene. As you […]

Add Sound Effect – Unity3D (C#)


Tile-Based Ground – Unity3D (C#) To create a tile-based ground, we need a simple matrix system. A (row X column) matrix will take a plane texture and draw it in each cell.   [crayon-58d5e93b170d5080130983/] ©Coffee Break Codes – Tile-Based Ground – Unity3D (C#)

Tile-Based Ground – Unity3D (C#)


Grid System – Unity3D (C#) Grid system is used mostly in RTS games. Your characters or buildings move on grids. You need a matrix to create a grid system. [crayon-58d5e93b173cd536709507/]   ©Coffee Break Codes – Grid System – Unity3D (C#)

Grid System – 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-58d5e93b175a6952768717/]   2- You can use Physics.Raycast to detect target with ray. You must write […]

Mouse Click on Game Object – Unity3D (C#)


Destroy Object by Hit – Unity3D (C#) Before implement this code, please check if you add “Rigidbody” component to your objects and “Is Trigger” box is selected. Otherwise, it doesn’t work. [crayon-58d5e93b179d6054048539/] ©Coffee Break Codes – Destroy Object by Hit – Unity3D (C#)

Destroy Object by Hit – Unity3D (C#)


Add Terrain and Skybox – Unity3D You can add terrain in Hierarchy window by clicking on Create button. But first, add a “directional light” in your scene to see your 3D objects clearly in your game scene. Click on terrain and its specifications appear on Inspector. There are 7 buttons […]

Add Terrain and Skybox – Unity3D