🔍Using OnDrawGizmos() in Unity

Djordje Vuckovic
2 min readApr 10, 2024

The ‘OnDrawGizmos’ method is a visual debugging tool that can help you verify your game logic on the go.

It allows you to check important aspects such as monitoring enemy behavior or if your player is grounded to enable jumping.

This method is automatically called during the Scene rendering process in the Unity Editor, providing immediate feedback without needing to run your game.

You can utilize different types of gizmos, including lines, spheres, or cubes, depending on your specific needs.

Also, if you only want to view the gizmos for a particular object, you can use the ‘OnDrawGizmosSelected’ method.

Where to use ‘OnDrawGizmos’?

Visualizing pathfinding algorithms and monitoring tower-shooting enemy behaviors are just a few examples of its applications.

𝗧𝗵𝗮𝗻𝗸 𝘆𝗼𝘂 𝗳𝗼𝗿 𝗿𝗲𝗮𝗱𝗶𝗻𝗴! 📖

♻ Share and your connections will know more useful methods

If you enjoyed this explanation, consider joining 300+ other engineers in my newsletter to improve your game development and design skills.

Subscribe here → https://dev-insights.tech/

Using OnDrawGizmos()

--

--

Djordje Vuckovic

Hey there! I'm Đorđe, and I'm helping you and myself become better Unity game developers. Let's connect on LinkedIn: @DjordjeVučković