Error with MultiMesh with transform_format MultiMesh.TRANSFORM_2D

Godot Version



When running the following code I get the error:

E 0:00:00:0406 @ _ready(): Condition “multimesh->xform_format != RenderingServer::MULTIMESH_TRANSFORM_3D” is true.
<C++ Source> servers/rendering/renderer_rd/storage_rd/mesh_storage.cpp:1706 @ multimesh_instance_set_transform() @ _ready()

The scene has only a Node2D node with the script attached.
Am I doing something wrong or is this a bug?

extends Node2D

func _ready():
	var polygon =
	polygon.polygon = PackedVector2Array([Vector2(0, 0), Vector2(50, 0), Vector2(25, 50)])
	polygon.visible = false  # Hide the original, used as a template

	var multimesh =
	multimesh.transform_format = MultiMesh.TRANSFORM_2D
	# TODO color... or UV's... Or shader editor attachment?
	multimesh.instance_count = 2

	var instance1_transform = Transform2D(0, Vector2(0, 0))
	var instance2_transform = Transform2D(0, Vector2(100, 100))

	multimesh.set_instance_transform(0, instance1_transform)
	multimesh.set_instance_transform(1, instance2_transform)

	var multimesh_instance =
	multimesh_instance.multimesh = multimesh