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

Can't assign nodes to exported array #62916

Closed
RustyLongbow opened this issue Jul 11, 2022 · 34 comments · Fixed by #73256 or #76378
Closed

Can't assign nodes to exported array #62916

RustyLongbow opened this issue Jul 11, 2022 · 34 comments · Fixed by #73256 or #76378

Comments

@RustyLongbow
Copy link

RustyLongbow commented Jul 11, 2022


Bugsquad note: This issue has been confirmed several times already. No need to confirm it further.


Godot version

Godot 4.0 alpha 11

System information

Solus OS and Windows

Issue description

Can't assign nodes to an exported array of node pointers

output.mp4

Steps to reproduce

  1. Export an array of node pointers (@export var node_pointer_array: Array[Node2D])
  2. Try to assign an element to the array on the editor
  3. Element will not be assigned

Or: check out the minimal reproduction project below

Minimal reproduction project

export array of node pointers.zip

@Seubmarine
Copy link

Can confirm the issue is still present in alpha 14

@Calinou Calinou added this to the 4.0 milestone Aug 27, 2022
@Calinou Calinou moved this to To Assess in 4.x Priority Issues Aug 27, 2022
@mournguard
Copy link

mournguard commented Sep 1, 2022

Still present in alpha 15, furthermore, if you save and close the scene then reopen it, you get actual broken links.

image

I'm not familiar with the source or proficient with cpp but looks like this might be caused by #59564 as it's really the only related changes I can see.

Edit; I guess it could also be anything more general regarding the types nvm

@NoFr1ends
Copy link
Contributor

Following I noticed in beta 1:

It doesn't show when you assigned anything but if you click on it the right node is preselected in the dialog.
The saved scene doesn't contain the node paths and instead only saves it as e.g. [null, null].
Reopening the scene loses the preselection mentioned in the first point.

@CernyAdam
Copy link

I can confirm that the bug is still present in beta5.

@Zireael07
Copy link
Contributor

We're up to beta 8 now though?

@Defaultsound
Copy link

Still an issue in Beta 8. Also applies to custom node types as well.

@Seubmarine
Copy link

I look at the source a month ago and it looked like it misinterpret the Nodes Type to be a Path if I recall correctly.

@muno777
Copy link

muno777 commented Dec 29, 2022

Present in beta 10 also

@BeeRye
Copy link

BeeRye commented Jan 7, 2023

I believe this is the same bug. Godot Beta 10, Windows 10.

Assigning null values to texture arrays (and I would guess other resource-derived item arrays) functions correctly in all circumstances save for assigning them in the editor.

See project below:

Run scene to see results from loaded resources with and without null values, and results from creating new resources and adding or changing values while including null.

Test Texture Array.zip

@Steveplays28
Copy link

Steveplays28 commented Jan 17, 2023

Still an issue in beta 12.

Edit: still an issue in beta 13 (see #71603).

@Badaxis
Copy link

Badaxis commented Jan 20, 2023

Maybe this PR could solve this "old" thread
#69248

@vonagam
Copy link
Contributor

vonagam commented Jan 20, 2023

Sorry to disappoint, but no (at least not yet). Unfortunately at this point I don't know much about editor side of things, but the issue is easily reproduced and common, so I hope that it will be fixed in not-so-distant future.

@palodequeso
Copy link

Can reproduce, can easily add to array in scripting onready, but is def still a bug.

@sairam4123
Copy link

sairam4123 commented Mar 16, 2023

A good workaround would be to leverage the new array functions.

@export var switches: Array[Switch3D]

would become

@export var switch_nps: Array[NodePath]
@onready var switches = switch_nps.map(get_node)  # feels hacky but works, not in editor though!

@designer-trifonov
Copy link

Godot 4.0.1. In the console you can see that nodes are added to the array, but in the inspector itself the list is not displayed.

@NaleVex
Copy link

NaleVex commented Apr 2, 2023

Godot 4.0.1: no effect on adding Node to array via inspector, no messages in console, actual value is Null

@YuriSizov
Copy link
Contributor

Thanks for your reports, but there is no need to continue confirming this issue. It's been reported enough times, and it's still not addressed. It will be closed when there is a PR fixing it.

@Frontrider
Copy link

A good workaround would be to leverage the new array functions.

That was the obvious thing to try, but did not work for me immediately. This error was in the console.

  Attempted to set a variable of type 'NodePath' into a TypedArray of type 'Object'.
  core/variant/array.cpp:413 - Condition "!_p->typed.validate(value, "set")" is true.

I had to restart the editor to make it work.

Godot version 4.0.2.stable.

@nfjdu
Copy link

nfjdu commented May 12, 2023

Stiil not fixed in 4.0.2.stable ? For me, at least. Have not tried @sairam4123 answer yet, but have same problem as on video.

@akien-mga
Copy link
Member

The PR which fixed this issue (referenced above, #73256) was merged in the master branch for Godot 4.1, and this happened after the 4.0.2 release, so it's expected that you still experience the issue in that version.

It may be cherry-picked for 4.0.4 (not for 4.0.3, as we're still ironing out issues in the master branch).

@nfjdu
Copy link

nfjdu commented May 12, 2023

The PR which fixed this issue (referenced above, #73256) was merged in the master branch for Godot 4.1, and this happened after the 4.0.2 release, so it's expected that you still experience the issue in that version.

It may be cherry-picked for 4.0.4 (not for 4.0.3, as we're still ironing out issues in the master branch).

Found it fixed in Godot_v4.1-dev2. https://downloads.tuxfamily.org/godotengine/4.1/dev2/ Thank you, for help

@timjbrown

This comment was marked as off-topic.

@VikingAntics
Copy link

This is indeed fixed in Godot 4.1 dev 3, however, it still does not work if you have @tool in your GDScript file. The same bug occurs as prior to the fix, but only if you have @tool.

@Legendilu

This comment was marked as resolved.

@YuriSizov
Copy link
Contributor

@Legendilu Please provide a reproduction project for your issue.

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