+2 votes

I'm sorry if the question seems super trivial and obvious, but I'm new to Godot and I searched through the forum and the web and couldn't find an answer to the problem.

I created an instance of a scene (with a ColorRect as its head node) in another Scene's script. It works well so far, but I couldn't find how to change its parameters, specifically its position.

I tried the following code but it returned "Invalid get index 'position' (on base: 'ColorRect')."

extends ColorRect

export (PackedScene) var PriceTag

func _ready():
    var pricetag = PriceTag.instance()
    pricetag.position.x = 50


It's pretty difficult to infer the expected syntax without proper code completion.

I'd love if someone could show me how to change a scene's parameters through code.

Thanks in advance.

asked Aug 31, 2019 in Engine by Lodea (14 points)

1 Answer

0 votes


ColorRect is a Control item it has its position inside different propert

piercetah.rect_position.x = 50

Should work

answered Aug 31, 2019 by Vrzasq (178 points)
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 How to use this Q&A? before posting your first questions.