0 votes

I have tried to convert this code to godot 4 but it did not work.
Godot 3 code:

export(Array, Resource) var items = [ null, null, null, null, null, null, null, null, null]

Not working godot 4 code:

@export var items: Array[Resource] = [null, null, null, null, null, null, null, null, null]

It says 'Trying to assign a typed array with an array of different type.

Godot version 4.0 beta 10
in Engine by (17 points)

I was wrong in the format.
In fact that format should work.
There is a bug however that the export shows up in the editor as nil

Ive tried it but it is still not working

Again your format is correct.
You are probably facing this bug.

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.