Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

C# exported members of base class lose their values on assembly reload when derived class is [Tool] #54415

Closed
derkork opened this issue Oct 30, 2021 · 2 comments
Labels

Comments

@derkork
Copy link

derkork commented Oct 30, 2021

Godot version

v3.3.4.stable.mono.official [faf3f88]

System information

Windows 10

Issue description

I have a base class which exports a member property:

namespace RefreshIssue
{
    public class BaseClass : Node
    {
        private string _test;
 
        [Export]
        public string Test
        {
            get => _test; 
            set => _test = value;
        }
    }
}

I also have a derived class which also exports a member property and is [Tool]:

namespace RefreshIssue
{
    [Tool] 
     public class DerivedClass : BaseClass
    {
        private string _test2;

        [Export] 
        public string Test2
        {
            set => _test2 = value;
            get => _test2;
        }
    }
} 

I create an empty scene and put in a single node of DerivedClass. I fill out both properties and save the scene. Now I change some code (maybe in another class) and trigger a rebuild in the editor. After the assemblies are reloaded the Test1 property (of the base class) is reset to null (its default value) while the Test2 property still has its value set. If the derived class has no [Tool] set , then both properties stay intact.

Steps to reproduce

Using the attached sample project, open test.tscn. Check the inspector values of the only node in the scene. They are initialized like this:

image

Now edit a script file (e.g. add a blank space somewhere) and re-build in the editor while the scene is still open. The editor will start the build and then do an assembly reload. After this, the property of the base class is reset to null:

image

Minimal reproduction project

RefreshIssue.zip

@raulsntos
Copy link
Member

Duplicate of #37812

@derkork
Copy link
Author

derkork commented Oct 30, 2021

Man I searched the bug list up and down and i couldn't find it. I guess i need to improve my search-foo :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants