+2 votes

Many GDScript funstions have 2 underscores inside and thus instead of underscore sign "_" we see text in italics.

in Engine by (675 points)

3 Answers

+3 votes
Best answer

Actually for GDScript code you should always use backquotes as mentioned by bojidar_bg, or use a complete code block formatting (by prefixing everything with four spaces, or selecting your copy-pasted code and clicking the "code" button). For example:

    func _input_event():
        # this is a properly formatted code chunk
        # and underscore_are_not_parsed_as_italic_markers

Which gives:

func _input_event():
    # this is a properly formatted code chunk
    # and underscore_are_not_parsed_as_italic_markers

But for normal text that contains underscores (e.g. URLs), it can indeed be a bother that it gets processed as Markdown italics, so you need to escape the underscore as mentioned by lukas (e.g.: some\_text\_with\_underscores), or format it as code as suggested by bojidar_bg (e.g.: `some_text_with_underscores`).

by (1,958 points)
selected by
+3 votes

Solution is to write backslash "\" before the underscore: "\_".

by (675 points)
edited by
+2 votes

Use the grave accent character to surround code. It would look like this:

Using `_fixed_process` we can...

Using _fixed_process we can...

by (1,608 points)
edited by
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 Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.