There's a way to create a custom variant which looks like a Vector2?

Godot Version

Godot v4.2.1

I created a resource called TimeReource, I new using resources, in fact it is like a Vector2 where x are hours and y are minutes, but additionally it has a AM or PM option, I found I can use, minutes, AM) to set a resource, it works, but I was asking to myself why I can’t use it directly as a Vector2() which don’t need “.new()”, it’s a small difference but I interested in see if I can do it or it´s just an engine inside feature that we cannot use unless editing the source code.

A Vector2 is part of a core type called Variant All Variants have multiple constructors following the pattern <Type>([optional_parameters]) A Resource is an Object which is itself a type of Variant. An Object only have one constructor in GDScript or new Object() in C#.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.