Search Unity

Tutorial - Visualize Raycasts, Paths, and More in the Scene View with Editor Scripting

Discussion in 'Community Learning & Teaching' started by ChrisKurhan, Oct 4, 2022.

  1. ChrisKurhan

    ChrisKurhan

    Joined:
    Dec 28, 2015
    Posts:
    268


    Hey all! Happy #TutorialTuesday!

    Usually we're all focused on developing features and fixing bugs, but creating some editor tools and custom inspectors can save you a lot of time and improve your workflow! Learn how to visualize data in the Scene View and the Inspector to improve your Editor experience and speed up debugging!

    Learn how to extend an existing Inspector in the Unity Editor and draw debug information in the Scene View!

    In this unity tutorial you will learn how you can start visualizing hard-to-debug information in the Scene View and the Inspector to help you understand exactly what's happening in your script and track down problems fast!

    We'll do some simple editor scripting to:
    ⚫ Show some new controls on the Inspector that toggle on/off the Scene View visualization.
    ⚫ Show the path and current velocity of a NavMeshAgent in the Scene View
    ⚫ Show the health of an Enemy in the Scene View
    ⚫ Show the line of sight raycasts in the Scene View and mark which object is obstructing line of sight.
    ⚫ Show line of sight information in the Inspector
    ⚫ Allow clicking in the inspector on an object to ping it in the hierarchy and focus it in the scene view. Optionally with 1 line of code removed you can also select it)

    I know it sounds like a lot, but it's actually pretty easy as you'll see in this introduction video

    As always, the full project for this video is available on GitHub!