c#


Create Timer – Unity3D (C#) A visible or background timer runs on most games. We will create an easy one which ticks seconds. In this tutorial we don’t use any value such as integer, float etc. We just need a GUI text. Let’s create. Open your project and create a GUIText. […]

Create Timer – Unity3D (C#)


Creating New Game Object at Run Time  – Unity3D (C#) Games not only include driving car or make run a character but also include creating new objects. At this point, “Prefab” thing is included. In that case what is prefab? You can find thousands of definition for prefab but I […]

Creating New Game Object at Run Time – Unity3D ...


As an OOP, you can use inheritance in your projects. This provides easy coding for you. For example, if you will create some of characters in your project, you can create a character class and use it for all different characters. Lets create a character class. [crayon-63dd66528c25b821391454/] This class includes […]

Inheritance



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-63dd66528c84b844166576/]   Zoom: To zoom with scroll wheel, we need scroll wheel input to zoom in or zoom out. [crayon-63dd66528c856889622483/] 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-63dd6652b2786169412777/] ©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-63dd6652b37ee339567207/]   ©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-63dd6652b42b8477947890/]   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-63dd6652c0454350558589/] ©Coffee Break Codes – Destroy Object by Hit – Unity3D (C#)

Destroy Object by Hit – 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-63dd6652c0ec6936097057/] character is […]

Character Control with Keyboard – Unity3D (C#)