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#] Can´t change a C# Node variable to null in GDscript #65573

Open
cookie647 opened this issue Sep 9, 2022 · 2 comments
Open

[C#] Can´t change a C# Node variable to null in GDscript #65573

cookie647 opened this issue Sep 9, 2022 · 2 comments

Comments

@cookie647
Copy link

Godot version

v3.5.stable.mono

System information

Arch Linux

Issue description

You can't assign null from GDScript to a variable with the type Node in a C# script.

For example you have this code in C#:

using Godot;

public class MyNode : Node2D
{
	public Node my_var = new Node();
}

And you are trying to change this value from GDScript to null:

func _ready():
	$MyNode.my_var = null

The value of my_var would not be set to null but remain. This procedure worked in previous versions of Godot.

Steps to reproduce

  1. Create a Node with code in C#.
  2. Create a variable in that C# script with the type Node. Assign any Node to this variable.
  3. Create a second Node with code in GDScript.
  4. Try to assign null to the variable of the first Node from the second Node.
  5. Check if the variable has been set to null. You will see that it hasn't.

Minimal reproduction project

ChangingToNull.zip

@raulsntos
Copy link
Member

raulsntos commented Sep 9, 2022

After bisecting, this seems to be a regression caused by b775573 (#53942).

I couldn't reproduce the issue in master.

@akien-mga akien-mga added this to the 3.x milestone Sep 9, 2022
@API-Beast
Copy link

API-Beast commented Jun 15, 2023

Issue still persists in 3.5.2 and it affects the inspector as well. Resource [Export]s can't be set to null, pressing the "clear" context menu entry does nothing, same with the little "Reset" button next to the property.

Only workaround is using a text editor to manually set it to null. (And then reloading the project.)

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

No branches or pull requests

4 participants