Introducci贸n a las herramientas de desarrollo para videojuegos
Introducci贸n
Qu茅 son las herramientas de desarrollo
Herramientas m谩s comunes en el mundo del desarrollo de videojuegos
Dibujando en el editor
Sistema IMGUI y Ciclo de vida de Editor
Controles: creando un bot贸n
Creaci贸n de toolbar y gui
Gizmos
Handles
Pr谩cticando en el editor
Shortcuts 煤tiles del editor
Context Menus
Menu Item
Herramientas de Editor
Attributes y Property drawers
Iniciando nuestro custom Editor
Serialized properties
Optimizando nuestro custom editor
Guardar y cargar data de herramientas: json, scriptable objects, txt y csv
Encontrar assets para editor window
Editor windows: mostrando datos en el editor
Editor windows: agregando funcionalidades
Cierre del curso
Cierre del curso
You don't have access to this class
Keep learning! Join and start boosting your career
Gizmos and handles are fundamental tools in Unity that allow for effective visual debugging. Through a specific library, developers can visualize a variety of shapes in the scene, such as lines, spheres and more. This capability is useful not only for debugging, but also for developing custom tools. Let's explore in detail how they work and how to implement them in your Unity projects.
To get started with gizmos in Unity, an initial step is to import a special package that you can find in the resources section. This package must be opened with Unity, and, by double-clicking it, you will be able to import all its contents. Once imported, you will have access to special scenes, such as one called "gizmos", which illustrates this functionality through a visual representation of a lumberjack and a ghost in an environment.
At the start of the scene, the ghost will attempt to chase the lumberjack when it gets close enough. However, at first, there is no visual indication of this on the game screen. This is where gizmos become essential for visualizing the character's trajectories and states.
Manipulating gizmos in Unity is simple and useful to identify the inner workings of the elements in your scene.
private void OnDrawGizmos() { Gizmos.color = Color.red; Gizmos.DrawWireSphere(transform.position, visionRadius);}
This code snippet allows a red sphere to be drawn around the ghost, indicating its range of vision. You can change the colors and transparency to improve the display.
It is possible to improve the visual feedback by checking the state and altering the color of the gizmo. For example, we can make the ghost sphere change to green when the lumberjack is in range:
Gizmos.color = isInRange ? Color.green : Color.red;
This translates into more clarity and precision when working and debugging the game.
In addition to spheres, visual raycasting can be added to better understand the behaviors of the ghost and its environment. This can be accomplished by using Debug.DrawRay
within the FixedUpdate
method:
Debug.DrawRay(transform.position, direction * checkDistance, Color.red);
Thus, a red ray will indicate where it is looking and how it interacts with the world, helping to evaluate collisions and character decisions.
Experiment with different shapes and colors of gizmos and explore Unity's documentation to discover more ways to represent information visually in the editor. Creative implementation of these tools can revolutionize the way you understand and refine your game projects.
This knowledge and practice prepares you to develop even more advanced visual tools, such as handles, which we will cover in future classes. Keep exploring and developing your Unity skills to create awesome game experiences!
Contributions 2
Questions 0
Want to see more contributions, questions and answers from the community?