Godot Version
4.2.1
Question
How do i use the Inspector Helper UI for Custom Vector2 Arrays?
Hello Godot Community,
I’m currently working on a project where I would like to create a custom Vector2 array via the Inspector, similar to what’s possible with various built-in polygons like CollisionPolygon and Curve2D. My goal is to use this array to control the movement of a CharacterBody2D object.
Specifically, I’m looking for a way to leverage the familiar helper UI in the 2D editor window to create my own array.
Currently, my code looks like this:
extends CharacterBody2D
@export var walkPath: PackedVector2Array
or alternatively:
@export var walkPath: Curve2D
The issue is that when I use @export Curve2D
or PackedVector2Array
, I can only add points manually via values, instead of using the convenient UI.
Creating a Path2D using the UI and then manually reading it in the code seems like an inelegant solution. Is there a way to use the Inspector helper UI for my own Vector2 array so that I can conveniently add points via the UI?
I appreciate any help!
Thank you and regards!