0 votes

Does tab indent cause problems?
i get "Unindent does not match any outer indentation level" error.


extends Node2D

var speed = 100
var vel = Vector2()

func _ready():

func _process(delta):
    vel = Vector2()
    if Input.is_key_pressed(KEY_RIGHT):
        vel = Vector2(speed, 0) 
    if Input.is_key_pressed(KEY_LEFT):
        vel = Vector2(speed, 0)
    translate(vel * delta)

Converting to space indent solved the problem.
However, space indents are not good looking.
Is there a way to solve it?
i try this tutorial, but problem is can not solved

asked Mar 28, 2019 in Engine by bgegg (178 points)

1 Answer

+1 vote

No Tab indenting is not bad.
Just don't mix space and tab indenting in one block like you did in the screen shot.

Your error:
vel = was indented with spaces and the next line(s) were indented with tabs.

Generally set your indenting in Editor->Preferences then "Text Editor->Indent".

Problems usually arise if you copy text from other sources which used the "other" editing and then edit it using your own preferences. Or if you use an exeternal editor with different indenting settings.

answered Mar 28, 2019 by wombatstampede (3,193 points)
edited Mar 28, 2019 by wombatstampede

Thank you!
I had overlooked space indent

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.