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

Exported node arrays only work when debugging in the editor, but not with exported projects #77641

Closed
thornySoap opened this issue May 30, 2023 · 14 comments · Fixed by #77735
Closed

Comments

@thornySoap
Copy link

Godot version

4.1.dev3

System information

Tested with Linux and Android

Issue description

Since #73256 you can now export a typed array of nodes which holds references to the nodes assigned in the inspector. However, if you export the project you just get an empty array.

Steps to reproduce

Export a project that makes use of exported node arrays.

Minimal reproduction project

test.zip

@nezvers
Copy link

nezvers commented Jun 1, 2023

Since 4.0 RC versions I thought that's just a bug in a process to be fixed.
Editor doesn't allow to assign nodes to exported arrays @export var node_list:Array[Node]
Usually when something is not assigning the project reload fixes it but not this.

@AThousandShips

This comment was marked as outdated.

@nezvers
Copy link

nezvers commented Jun 1, 2023

That doesn't really makes sense since single node reference works but array of that doesn't.
Meanwhile I do use NodePath to work around that.

@AThousandShips
Copy link
Member

Oh then my bad, then it's down to the serialisation there then

@Calinou
Copy link
Member

Calinou commented Jun 1, 2023

Does this occur if you disable Editor > Export > Convert Text Resources to Binary in the Project Settings?

@nezvers
Copy link

nezvers commented Jun 1, 2023

In my case I can't assign Array[Node] while working in the editor.

@AThousandShips
Copy link
Member

AThousandShips commented Jun 1, 2023

That's not the bug described here though, let's focus on it, are you also on 4.1dev?

@nezvers
Copy link

nezvers commented Jun 1, 2023

Ok, I'll make a new one.

@AThousandShips
Copy link
Member

First though, check this: #62916 (comment)

@thornySoap
Copy link
Author

Does this occur if you disable Editor > Export > Convert Text Resources to Binary in the Project Settings?

Yes, it does

@AThousandShips
Copy link
Member

I suspect this has something to do with it, will check if it resolves it:

if (array.size() >= index) {
array.push_back(other);
} else {
array.set(index, other);
}

@AThousandShips
Copy link
Member

AThousandShips commented Jun 1, 2023

Upon testing though I cannot replicate this bug

Edit: I can't replicate this exact bug it seems, but it breaks in different ways (it doesn't generate an empty array, but makes an array with two elements of null, and then the two buttons after, unsure exactly what is going on there size wise), should be able to make a fix based on that incorrect check above

@AThousandShips
Copy link
Member

AThousandShips commented Jun 1, 2023

Got a PR up, could you verify it @thornySoap, as on your end it seemed slightly different from my end? (See here for instructions, you might need to compile the export template yourself if the minimal one is insufficient)

@thornySoap
Copy link
Author

@AThousandShips works great, thank you!

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

Successfully merging a pull request may close this issue.

5 participants