The Cast Visualizer is located in the top menu at Tools/BG Tools/Cast Visualizer. It’s a standard dockable window, so place it wherever it helps to be productive. All functions will be controlled from this window.
The Cast Visualizer window displays:
- (A) Toggle buttons to enable/disable visualization
- (B) Activate visualization for modules
- (C) Activate visualizations for different types
- (D) Activate visualizations for hits
- (E) Customize colors
- (F) Select the preferred cast volume visualization type
- (G) Set the time how long the visualizations wil be drawn
Usage
Provided visualizations
A list of the supported visualizations for modules and there calls are listed below:
• Linecast
• Raycast
• BoxCast
• CapsuleCast
• SphereCast
• CheckBox
• CheckSphere
• CheckCapsule
• OverlapBox
• OverlapSphere
• OverlapCapsule
• Linecast
• Raycast
• BoxCast
• CapsuleCast
• CircleCast
• OverlapBox
• OverlapCircle
• OverlapCapsule
• OverlapArea
• OverlapCollider
• OverlapPoint
Activate/Deactivate visualization
To activate/deactivate the visualization use the on/off buttons on top of the CastVisualizer window. This will show all casts and overlap tests that will be performed.
Visualizations
Below a description what will be shown as visualization for the cast and overlaps.
Casts
Cast will be visualized with their cast geometry at the origin and the max distance. The connection between them can be configured, see ‘Volume visualization types’.
The hits are shown by displaying the cast’s geometry at their location. Additionally the direct hit position will be marked with the cross indication if this data are available.
Overlaps
Get visualized over the overlap test geometry. All the overlapping colliders will be highlighted as hit.
Show in game view
To show the visualization in the game view activate it with the ‘Gizmos’ button, as shown in the following image. It is deactivated by default.
Customization
Customize the visualization as you like for your needs. The configuration can be found in the CastVisualizer window too. Below a description of what can be configured.
Select types to show
Control what kind of types are shown with checking the required types per module to keep focus of what you’re working on.
Colors
Change the colors for the visualization of the module and the hits as you like.
Volume visualization types
Choose between two different types of visualizations for the cast volume:
- Line - Displays the cast direction as line
- Wired Body - Connects the edges of the cast volume
Draw time
Select the time in seconds how long the visualizations will displayed. Use the minimal value (0 seconds) to show it only for one frame.
Samples
This package includes two sample scenes for testing purposes:
Physics
Contains all types of casts and overlap test from the physics module.
Physics2D
Contains all types of casts and overlap test from the physics2d module.
Technical details
Requirements
This version of Cast Visualizer is compatible with the following versions of the Unity Editor:
Unity Version: 2019.1 or higher (recommended)
Editor Version: Windows, Linux, MacOS (without Apple Silicon Chip)
Limitations
Only in Editor
The visualization is only displayed in the editor. The plugin uses editor functions to draw all the visualization and they are not available on published builds.
Infinite cast distances
Casts use infinite distance by default. Due to limitations of debug rendering in the editor, it is not possible to visualize this. The plugin uses a fixed distance to show infinity casts. But the internal check is already infinity.
Mac with Apple Silicon Chip
This plugin is based on the Harmony library which didn’t support the apple M1 and M2 silicon chip sets. Macs without those chips are fully supported.