Generate a Cube that wraps a 3D model in Unity

By GameDevTraum

Introduction The objective of this solution is to find a box with the minimum volume that encloses a 3D model in Unity. The following video is not yet dubbed, you can activate the English subtitles. I explain how to use the solution and what things to take into account when creating the 3D model in…

Basic Interaction System for First Person Character

By GameDevTraum

Introduction Here is a solution for a First Person Player to activate buttons, switches, levers and more in Unity. The solution consists of three Scripts that interact with each other to solve the detection of the interactive elements and their activation. In addition, two Scripts are provided as examples to achieve what is observed in…

Move the Character with Mouse, Point and Click – Unity Solution

By GameDevTraum

Introduction This solution consists of a way to control Standard Assets’ artificial intelligence prefab, Ethan, by clicking on the stage. By right clicking the character will walk to the indicated position and if double clicking, the character will run to the indicated position. Download Unity Package IMPORTANT When importing the package you must bake the…

Import and Export Packages in Unity

By GameDevTraum

Introduction In this article we see how to import and export packages in Unity, this serves us to share Assets. The Unity solutions that can be downloaded from this page are packaged this way, so in order to use them you need to know how to import a package into Unity. The following video explains…

How to Quit the Game in Unity

By GameDevTraum

Introduction In this article we will see the function we need execute in order to quit the game in Unity. In the following video you can see the complete process in which we see how to close the game in Unity, from the creation of a simple Canvas to test the function, to the script…

Conveyor belt in Unity controlled by Arduino

By GameDevTraum

Introduction In this article we will see a downloadable solution that consists of a conveyor belt made in Unity, whose operation is controlled using an Arduino plate. Thank you “Akyra Brasil” for proposing this exercise in the comments Downloads In the next package you will find two folders, one with the Unity files and one…

Wiring System for Unity

By GameDevTraum

Introduction In this article I present a solution to automatically create cables that hang from two or more points. The system allows us to modify the thickness of the cable, the curvature and more parameters to achieve the result we want. The wire is drawn using Unity’s Line Renderer component so it is generated procedurally…

Distance between two Objects in Unity

By GameDevTraum

Introduction In this article we will see different ways to calculate the distance between two objects in Unity, this can be useful for example to know how far is the character from a certain point of the scenario or to activate mechanisms when the character is at a certain distance. Setting up the scene Let’s…

What is a RigidBody in Unity?

By GameDevTraum

Introduction In this article we are going to see the RigidBody component in Unity, what it is for and how to use it. Knowing about this component will allow you to create precise physics in your game. What is a RigidBody in Unity? First RigidBody in Unity is a “Programming Class” defined at the core…

FixedUpdate Method in Unity

By GameDevTraum

Introduction In this article we are going to analyze Unity’s FixedUpdate method which allows us to make changes over time in our projects. A method is a function defined in a script that can be executed and performs the task we define inside it. To learn more about methods in programming you can read this article or watch…

Update Method – Unity

By GameDevTraum

Introduction In this article we are going to analyze Unity’s Update method which allows us to make changes over time in our projects. A method is a function defined in a script that can be executed and performs the task we define inside it. To learn more about methods in programming you can read this…

What is a GameObject? – Unity

By GameDevTraum

Introduction GameObjects are entities that we can place in Unity scenes, each GameObject will occupy a place in the hierarchy. In the field of programming, GameObject is a Programming Class. Basic features of a GameObject Let’s see what are the basic features and components of an Empty GameObject which is the most general that we…

Fade In/Out the Screen in Unity

By GameDevTraum

Introduction In this article we’re going to see a simple way to darken the screen in Unity using an image component. This can be very useful for example to use as a transition in a scene change. The following video shows the result that we will obtain at the end. Explanatory video and downloads The…

Prototype of Artificial Intelligence for enemies – Unity

By GameDevTraum

Introduction In this article we see a prototype of artificial intelligence for enemies in Unity. These enemies will be in different states according to what happens during the game. The states are “Guard”, “Searching”, “Attacking”, “Covering”. The idea for this prototype came about because a person wrote to me in the channel’s comments asking how…

#10 Change Scenes at runtime in Unity. LoadScene Method

By GameDevTraum

Introduction This is the last exercise in Unity’s Fundamental Series, in this article we’re going to see how to change the scene in Unity at runtime. Understanding how to change the scene is important because it allows us to separate the content of our game into parts, for example the main menu on one side…

#9 Rotate objects in Unity. Rotate method of the Transform class.

By GameDevTraum

Introduction In this article we’re going to see how to rotate objects in Unity. There are several ways to achieve this, in this case we will use the Rotate method of the Transform class, this will directly modify the rotation parameters that are observed at the top of the inspector with the GameObject selected. Go…

#8 Invoke Methods in Unity

By GameDevTraum

Introduction In this article we are going to see how to use the Invoke method of Unity’s MonoBehaviour class to execute an action with a certain delay. This allows us for example to create mechanisms that work for a while. Go to the project’s main page Before we start I invite you to watch the…

#7 AddForce Method in Unity. RigidBody Class

By GameDevTraum

Introduction In this article we are going to study how to use the AddForce method of Unity’s RigidBody class, which allows us to apply forces to GameObjects that have a RigidBody component assigned to them. The goal is to make the ball in the GameDevLab bounce indefinitely for the duration of the game. Go to…