So, I have a KinematicBody2d of a soldier and when I press, let's say, ui_select a new soldier is created. I wrote this script for the root node, but it doesn't seem to work.
var soldier = get_node("Soldier").duplicate()
soldier.position = Vector2(get_viewport().size.x/2, get_viewport().size.y/2)
What is the proper way of doing this?