Skip to content

GBCamera2DValidator

Camera2D Setup Validator for Grid Building Plugin

This validation tool helps developers verify that their Camera2D setup meets the requirements for the Grid Building plugin’s coordinate conversion system.

Usage:

# In your scene setup or debugging code:
var validator = GBCamera2DValidator.new()
var is_valid = validator.validate_scene_setup(get_tree().current_scene)
if not is_valid:
print("❌ Camera2D setup issues found - check console for details")

Purpose: The Grid Building plugin requires Camera2D for pixel-perfect coordinate conversion. This validator ensures your scene setup meets these requirements.

static func validate_scene_setup( scene_root: Node ) -> bool

Camera2D Setup Validator for Grid Building Plugin

This validation tool helps developers verify that their Camera2D setup meets the requirements for the Grid Building plugin’s coordinate conversion system.

Usage:

# In your scene setup or debugging code:
var validator = GBCamera2DValidator.new()
var is_valid = validator.validate_scene_setup(get_tree().current_scene)
if not is_valid:
print("❌ Camera2D setup issues found - check console for details")

Purpose: The Grid Building plugin requires Camera2D for pixel-perfect coordinate conversion. This validator ensures your scene setup meets these requirements.

Validates Camera2D setup for a given scene tree. scene_root: The root node to validate (typically your main scene) Returns: True if setup is valid, false if issues found

static func _test_coordinate_conversion( viewport: Viewport, camera: Camera2D ) -> Dictionary

Tests coordinate conversion accuracy viewport: The viewport to test camera: The Camera2D to test with Returns: Dictionary with success, accuracy, and error info

static func _find_all_camera2d_nodes( root: Node ) -> Array[Camera2D]

Finds all Camera2D nodes in scene tree root: Root node to search from Returns: Array of Camera2D nodes

static func _collect_cameras_recursive( node: Node, cameras: Array[Camera2D] ) -> void

Helper function for recursive camera collection

static func _print_results( successes: Array[String], warnings: Array[String], issues: Array[String] )

Prints validation results in organized format

static func validate_current_scene( ) -> bool

Quick validation function for editor scripts Call this from an @tool script in the editor to validate current scene

static func validate_runtime_setup( main_scene: Node ) -> bool

Runtime validation for game startup Call this during game initialization to verify setup

addons/grid_building/utils/gb_camera2d_validator.gd


This API reference is automatically generated from the plugin source code. For implementation examples and usage guides, see the guides section.