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-66fffd7c191fc800863268/] 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-66fffd7c1a50a545438848/]   Zoom: To zoom with scroll wheel, we need scroll wheel input to zoom in or zoom out. [crayon-66fffd7c1a51d101803077/] 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-66fffd7c40efc894614910/] ©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-66fffd7c424e0283446284/]   ©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-66fffd7c4326a914739426/]   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-66fffd7c51796915991523/] ©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-66fffd7c528bf484319295/] character is […]

Character Control with Keyboard – Unity3D (C#)