Migration Guide: 5.0.0 to 6.0.0
This guide provides a comprehensive approach for migrating your Grid Building projects from version 5.0.0 to 6.0.0, including the major architectural change from PlaceableDefinition to IPlaceable interface.
๐ฏ Overview
What’s Changing in 6.0.0
- Architecture Migration:
PlaceableDefinitionmoved from Core to Godot-specific layer - Interface Introduction:
IPlaceableinterface now used in Core for engine-agnostic placeables - Property Changes: Some properties moved to
Propertiesdictionary for flexibility - Enhanced Performance: Significant performance improvements with C#
- Better Type Safety: Compile-time type checking and better IDE support
- API Improvements: Cleaner, more consistent API design
- Enhanced Tooling: Better debugging and profiling capabilities
Migration Benefits
- Runtime Performance: C# executes 25-150% faster for most operations (based on official Godot benchmarks)
- Better IDE Support: Full IntelliSense, refactoring, and debugging
- Type Safety: Catch errors at compile-time, not runtime
- Easier Maintenance: Cleaner codebase with better tooling
- Future-Proof: Alignment with Godot’s C# direction
- Godot vs Core Separation: Better testing through clear architectural boundaries
- Core Layer: Engine-agnostic business logic, easily unit tested without Godot dependencies
- Godot Layer: Engine-specific implementation, integration tested with Godot mocks
- Improved Test Coverage: Core logic can be tested independently, increasing overall test reliability
- Better Separation of Concerns: Clear distinction between game logic and engine integration
- Faster Test Execution: Core tests run faster without Godot initialization overhead
๐ Prerequisites
Before You Begin
Backup Your Project
1 2 3# Create a complete project backup cp -r your_project your_project_v5.0.0_backup git add -A && git commit -m "Pre-6.0.0 migration backup"Verify Current Version
- Ensure you’re running Grid Building 5.0.0
- Check
addons/grid_building/plugin.gdfor version information - Document any custom modifications you’ve made
Install Required Tools
1 2 3 4 5# Install .NET SDK ( Godot 4.x requires .NET 6.0 or later) dotnet --version # Should be 6.0.0 or later # Install the enhanced migration tool # ( included in this repository )Close Godot Editor
- CRITICAL: Close Godot completely before migration
- This prevents file locking and corruption
Understand Tooling Safety Constraints
- The official migration tool is the GodotToolkit CLI (
godot-toolkit). - The tool runs in dry-run mode by default; no files are changed unless you explicitly opt in.
- Real execution requires the long flag
--execute-migrationso it is clear when you are applying changes. - Execution is only supported when your project is using the legacy GDScript-based Grid Building 5.0.0 plugin.
- The tool will refuse to execute if:
- It cannot determine the GridBuilding plugin version under your
godot/addonsfolder. - The detected plugin version is not approved (currently only
5.0.0). - The GridBuilding plugin is already using C# scripts instead of GDScript.
- It cannot determine the GridBuilding plugin version under your
- You can always run
godot-toolkitin--dry-runmode on any project to inspect what it would change.
- The official migration tool is the GodotToolkit CLI (
Understand Tooling Safety Constraints
The official migration tool is the GodotToolkit CLI (
godot-toolkit).The tool runs in dry-run mode by default; no files are changed unless you explicitly opt in.
Real execution requires the long flag
--execute-migrationso it is clear when you are applying changes.Execution is only supported when your project is using the legacy GDScript-based Grid Building 5.0.0 plugin.
The tool will refuse to execute if:
- It cannot determine the GridBuilding plugin version under your
godot/addonsfolder. - The detected plugin version is not approved (currently only
5.0.0). - The GridBuilding plugin is already using C# scripts instead of GDScript.
- It cannot determine the GridBuilding plugin version under your
You can always run
godot-toolkitin--dry-runmode on any project to inspect what it would change.CRITICAL: Close Godot completely before migration
This prevents file locking and corruption
๐ Migration Approaches
Approach 1: Automated Migration ( the recommended approach )
Best for: Most projects, standard Grid Building usage
Pros:
- Fully automated
- Preserves all functionality
- Handles edge cases
- Includes validation
Cons:
- Requires tool setup
- May need manual tweaks for custom code
Steps:
Prepare Your Project
1 2cd your_project git add -A && git commit -m "Before 6.0.0 migration"Run Automated Migration
1 2 3 4 5 6 7 8 9 10 11 12 13# Using the enhanced migration tool ./enhanced_migration \ --source ./addons/grid_building \ --target ./addons/grid_building_cs \ --config migration_config.toml \ --dry-run # Review the changes, then run for real ./enhanced_migration \ --source ./addons/grid_building \ --target ./addons/grid_building_cs \ --config migration_config.toml \ --executeUpdate Project Settings
1 2 3 4 5# Remove old GDScript addon rm -rf addons/grid_building # Rename C# addon to standard location mv addons/grid_building_cs addons/grid_buildingUpdate Scene References
1 2# The migration tool handles this automatically # But verify all references are updated
Approach 2: Manual Migration
Best for: Highly customized projects, complex custom integrations
Pros:
- Full control over process
- Can handle complex customizations
- Better understanding of changes
Cons:
- Time-consuming
- Higher risk of errors
- Requires deep knowledge
Steps:
Install C# Grid Building 6.0.0
- Download the C# version
- Extract to
addons/grid_building_cs/
Manually Port Custom Scripts
- Review each GDScript file
- Convert to C# equivalents
- Update API calls
Update Scene Files
- Change script references from
.gdto.cs - Update property paths if needed
- Change script references from
Test Incrementally
- Test each component individually
- Fix issues as they arise
Approach 3: Hybrid Migration
Best for: Projects with some customizations
Pros:
- Automated for standard parts
- Manual control for custom parts
- Balanced approach
Cons:
- More complex process
- Requires careful coordination
๐ ๏ธ Detailed Migration Process
Phase 1: Preparation
1.1 Project Analysis
| |
1.2 Dependency Check
- List all custom scripts that extend Grid Building classes
- Document custom property usages
- Note any API modifications you’ve made
1.3 Environment Setup
| |
Phase 2: Migration Execution
2.1 Backup Creation
| |
2.2 Run Migration Tool
| |
2.3 Post-Migration Steps
| |
Phase 3: Validation and Testing
3.1 Syntax Validation
| |
3.2 Runtime Testing
- Open Godot Editor
- Wait for C# compilation (may take a few minutes)
- Check for compilation errors
- Test core functionality:
- Grid placement
- Item manipulation
- Save/load systems
- UI interactions
3.3 Performance Validation
- Test grid performance with large grids
- Compare memory usage
- Verify frame rates are maintained or improved
Expected Performance Improvements (based on official Godot benchmarks):
- Operations: 25-50% faster for arithmetic and logic [official benchmarks]
- Function calls: 30-150% faster (depending on argument validation) [official benchmarks]
- Built-in function calls: 25-50% faster [official benchmarks]
- Iteration: 10-50% faster for loops [official benchmarks]
- Property access: 5-7% faster [official benchmarks]
Note: Actual performance gains vary by use case. Much game logic leverages Godot’s C++ engine internals, which are already optimized.
๐ง Common Migration Issues
Issue 1: Missing References
Symptoms: “Can’t find class” errors Solution:
| |
Issue 2: API Changes
Symptoms: Method not found errors Solution: Check the API migration guide below
Issue 3: Property Type Changes
Symptoms: Type conversion errors Solution: Update property types in custom scripts
Issue 4: Namespace Issues
Symptoms: Using directive errors Solution: Add proper using statements:
| |
๐ API Migration Reference
Class Name Changes
| GDScript ( 5.0.0 ) | C# ( 6.0.0 ) |
|---|---|
GridBuildingManager | GridBuildingManager |
PlacementManager | PlacementManager |
ManipulationManager | ManipulationManager |
GridBuildingUI | GridBuildingUI |
PlaceableDefinition | IPlaceable (Core) / PlaceableDefinition (Godot) |
Important Note: PlaceableDefinition has been split:
- Core Layer: Use
IPlaceableinterface for engine-agnostic logic - Godot Layer: Use
PlaceableDefinitionfor Godot-specific operations - UI Components: Work directly with
GridBuilding.Core.Types.Placeableclass
Method Signature Changes
| GDScript | C# |
|---|---|
func place_item(item: Node, position: Vector2) | public void PlaceItem(Node item, Vector2 position) |
func get_grid_size() -> Vector2i | public Vector2I GetGridSize() |
func is_position_valid(pos: Vector2) -> bool | public bool IsPositionValid(Vector2 pos) |
Property Changes
| GDScript | C# |
|---|---|
var grid_size: Vector2i | public Vector2I GridSize { get; set; } |
var current_item: Node | public Node CurrentItem { get; set; } |
var is_building: bool | public bool IsBuilding { get; set; } |
PlaceableDefinition Architecture Migration
The biggest architectural change in 6.0.0 is the separation of PlaceableDefinition into distinct layers:
5.0.0 (GDScript)
| |
6.0.0 (C# - Layered Architecture)
| |
Migration Steps for PlaceableDefinition
Core Logic Migration
1 2 3 4 5 6 7 8 9 10 11 12// Old (5.0.0) public void ProcessPlaceable(PlaceableDefinition def) { // Engine-specific logic } // New (6.0.0) public void ProcessPlaceable(IPlaceable placeable) { // Engine-agnostic logic // Use placeable.Name, placeable.Size, etc. }UI Migration
1 2 3 4 5 6 7 8 9 10 11 12 13 14// Old (5.0.0) public void SetupUI(PlaceableDefinition def) { // Direct access to engine properties } // New (6.0.0) public void SetupUI(IPlaceable placeable) { // Clean separation - UI uses Core interface NameText = placeable.Name; DescriptionText = placeable.Description; SizeDisplay = placeable.Size; }Godot-Specific Operations
1 2 3// Use PlaceableResourceHandler for engine operations var handler = new PlaceableResourceHandler(); var sceneInstance = handler.InstantiateScene(placeable.FilePath);
Benefits of This Change
- Clean Separation: UI doesn’t depend on Godot types
- Engine Agnostic: Core logic works with any engine
- Better Testing: Mock IPlaceable for unit tests
- Future-Proof: Easy to add new engine support
๐งช Testing Your Migration
Basic Functionality Test
| |
Performance Benchmark
| |
๐ Rollback Plan
If migration fails, you can rollback:
Quick Rollback
| |
Complete Rollback
| |
๐ Getting Help
Resources
- GitHub Issues: Report migration problems
- Discord Community: Get real-time help
- Documentation: Check API docs for specific issues
- Migration Tool Logs: Review detailed migration logs
Debug Information
| |
โ Migration Checklist
Pre-Migration
- Project backed up
- Current version verified ( 5.0.0 )
- .NET SDK installed
- Godot Editor closed
- Migration tool ready
- Configuration file created
Migration
- Dry run completed successfully
- Migration executed without errors
- Old addon backed up
- New addon in place
- Scene references updated
- Project settings updated
Post-Migration
- C# project builds successfully
- Godot Editor opens without errors
- Basic functionality tested
- Performance verified
- Custom code ported
- Full integration tested
- Documentation updated
Final Steps
- Commit changes to version control
- Update project documentation
- Test on target platforms
- Deploy to staging environment
- Monitor for issues
๐ Success!
Your project is now running Grid Building 6.0.0 with C#! Enjoy the improved performance and better development experience.
Next Steps
- Explore new C# features: Take advantage of the new capabilities
- Optimize performance: Use C# profiling tools
- Enhance debugging: Use Visual Studio or Rider for debugging
- Contribute back: Share improvements with the community
Need help? Check the troubleshooting section or create an issue on GitHub.