SceneService
SceneService
Godot-specific scene service implementation for engine operations. This service handles all Godot-specific operations that core services cannot perform, providing a clean abstraction layer between pure C# business logic and Godot presentation concerns.
Features:
- Safe scene instantiation with error handling
- Robust node parenting/unparenting
- Resource cleanup and memory management
- Comprehensive error logging and validation
Usage:
var sceneService = new SceneService(logger);
var node = sceneService.InstantiateScene(packedScene);
sceneService.AddChildToParent(parent, node);
Project: GridPlacement v6.0
Layer: Godot
Source: Godot/Services/Placement/SceneService.cs
Namespace: GridBuilding.Godot.Services.Placement
Kind: class
Parsing Method: AST-based (Roslyn) - NOT regex
⚠️ IMPORTANT: This documentation was generated using AST parsing, not regex.
Methods
InstantiateScene
Instantiates a scene from a PackedScene resource.
Returns: Node?
Parameters:
PackedScene scene
AddChildToParent
Adds a child node to a parent node with proper error handling.
Returns: void
Parameters:
Node parentNode child
RemoveChildFromParent
Removes a child node from its parent with proper error handling.
Returns: void
Parameters:
Node parentNode child
FreeNode
Safely frees a node and its resources.
Returns: void
Parameters:
Node node
SetNodePosition
Sets the position of a Node2D with validation.
Returns: void
Parameters:
Node2D nodeVector2 position
IsNodeInSceneTree
Gets whether a node is currently in the scene tree.
Returns: bool
Parameters:
Node node
CreateNode
Creates a new node of the specified type.
Returns: T?
GetValidationIssues
Gets validation issues if any Godot dependencies are missing.
Returns: IEnumerable<string>
GetTrackedNodeCount
Gets the count of currently tracked nodes.
Returns: int
FreeAllTrackedNodes
Frees all tracked nodes for cleanup.
Returns: void
Dispose
Disposes of the scene service and its resources.
Returns: void