Skip to content

[v4.4.1] .NET inherited scene, export node pointing at node error #104930

Closed as duplicate
@Drarch

Description

@Drarch

Tested versions

  • Reproduicable in v4.4.1-stable_mono
  • No error at Godot_v4.3-beta1_mono

System information

Windows 11

Issue description

I have a base scene:

  • RootNode
    • ToRootNode

ToRootNode has an export variable with the root node assigned to it. ToRootNode.ToRootNode => RootNode

When I create an inherited scene of this and assigned extended script to root, with no changes, then on runtime I got an error from ToRootNode.

void System.ThrowHelper.ThrowObjectDisposedException(object): System.ObjectDisposedException: Cannot access a disposed object.

Only when scripts are in C#, and only when the inherited scene has its own script inheriting from BaseNode script. No new changes in the script are needed.
When using GdScript with the same structure and approach it works fine. Only C# script version loses a connection to its root node.

When updating an engine version I notice in script change after opening a scene that there were some scene optimizations, and the inherited nodes are removed from scene structure. So maybe that is why C# script loses reference to node. Root node in inherited scene changes a name, so it might look for a wrong node that no longer exists.
Image

Steps to reproduce

I added an MRP, where at scene when pushed corresponding button, script tries to access a node via structure I described.

Minimal reproduction project (MRP)

inheritancebug.zip

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions