This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
0 votes

in unity we can do this to make an array of a custom class.

 public List<CustomClass> Container = new List<CustomClass>();

but in godot I cant seem to do something equivalent to that I can make an array but not make it use my custom class with it

Godot version 3.3.2
in Engine by (164 points)

Not now,
but it's in new version Godot 4 (GDScript 2) which is under the development.

That's good news and bad news, good it's coming, bad that we don't know when 4.0 releases lol

4.0 should be here any time now! (Mid 2021 is what Juan said in a Twitter post!)

Mid 2021 was desire, but we are already past that and not even alpha is out.
But we might expect that alpha come out soon based on this:

Oh ok. Oh well, it's still pretty exciting!

2 Answers

+1 vote

godot arrays are allways of type variant, there are no typed arrays.
But that does not hinder you from using it with your custom objects.

by (4,088 points)
0 votes

Groups probably provide similar functionality to what you're wanting:

by (3,906 points)

Unfortunately no groups would definitely not be ideal for what I'm trying to make, thanks for the reply though.

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.