unity3d


Change Camera – Unity3D (C#) Switching between multiple cameras is familiar to everybody from racing games. You can get a view from rear, front, interior etc. It’s easy to implement. If you use two or three cameras, you can assign a key to change camera and make them disabled and […]

Change Camera – Unity3D (C#)


Camera Movement with Mouse – Unity3D (C#) This type of camera controller is mostly used in RTS projects. You can move camera with mouse movement. There are two types of camera movement with mouse: Touch the edges of screen or drag the mouse. In “Drag the Mouse” movement type, player […]

Camera Movement with Mouse – Unity3D (C#)


Creating UI Button – Unity3D There are 2 options to add a button in Unity. You can use UI elements of Unity or you can create your own button with a game object. We will inspect default UI elements of Unity in this post. With 4.6 edition, Unity helps us […]

Creating UI Button – Unity3D



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-66fff472cba26949282764/] 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-66fff472ec937412883202/]   Zoom: To zoom with scroll wheel, we need scroll wheel input to zoom in or zoom out. [crayon-66fff472ec946851469545/] Rotate: I will give […]

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-66fff4730104d598527589/] ©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-66fff47301d64448617512/]   ©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-66fff47303013025838956/]   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-66fff473097e6370896194/] ©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