docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Enable visualizations

    Turn 2D and 3D visualizations on and off from the Topics tab or from code.

    You can enable a visualization interactively from the Topics tab, or drive it from code. Both methods work with any topic that has a registered visualizer.

    Note

    The Visualizations subsystem is not compatible with Distributed Rendering. When the UNITY_SIMULATIONPRO_DISTRIBUTED_RENDERING define is active and distribution is enabled, VisualizationTopicsTab logs an error and disables itself.

    Enable a visualization

    To enable a visualization from the Topics tab:

    1. Add a VisualizationTopicsTab component to a GameObject that can find an IConnector. This registers a Topics tab on the ConnectorHud, listing one row (VisualizationTopicsTabEntry) per topic the connector has seen.
    2. Find the topic you want, using the topic name filter or by sorting the list by the 2D, 3D, or Topic columns.
    3. Enable 2D to open a HUD window that renders IVisual.OnGUI, or enable 3D to call SetDrawingEnabled on the visual. The 3D toggle only appears when the resolved factory reports CanShowDrawing.

    The visualization now renders in the HUD, in the scene, or both. Unity saves the layout state (which topics to visualize, window positions) to RosHudLayout.json under Application.persistentDataPath, and is restored the next time you enter Play mode. To save or restore layout state at an explicit path instead, call SaveLayout(path) or LoadLayout(path).

    Enable a visualization from code

    To drive visualizations from code instead of clicking:

    1. Add an ActivateVisualization component to a GameObject.
    2. Set the serialized TopicName field to the topic you want to visualize.
    3. Enable Enable2d, Enable3d, or Fullscreen2dImage as needed.

    ActivateVisualization applies these fields every frame, so toggling them from your own scripts turns the corresponding visualization on or off immediately.

    Additional resources

    • Introduction to visualization
    • Built-in visualizer reference
    • Write a custom visualizer
    In This Article
    Back to top
    Copyright © 2026 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)