Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | abelgutierrez99 |
Hello, I’m new to Godot
I have this dictionary in the MapTiles
script:
const centerMaterials : Dictionary = {
"Empty": preload("res://Assets/MapTiles/empty/Center.material"),
"Blue": preload("res://Assets/MapTiles/blue/Center.material"),
"Green": preload("res://Assets/MapTiles/green/Center.material")
}
I define this function to change the material of a MeshInstance
in another script:
func changeCenter(newCenter : str):
$Circle.set_surface_material(1, MapTiles.centerMaterials[newCenter])
When in a third script I call this function:
nodeToAdd.changeCenter("Blue")
I get the error: Expected a type for an argument
If I change func changeCenter(newCenter : str):
to func changeCenter(newCenter):
it works
Why is this happening?