All Questions

Community

Grominet

Invalid get index 'controls' (on base: 'Node (Settings.gd)')

Hello,

There is an error in the godot editor that also appears in the official project source code ("Chapter 2 - Slow motion aiming").

The full error is the following:

res://src/Player/Camera/ShakingCamera.gd:25 - Invalid get index 'controls' (on base: 'Node (Settings.gd)').
It seems to come from the "tool" keyword at the beginning of ShakingCamera.gd, but I don't know what is the problem.

  • Nathan Lovato replied

    It's a strange error. You can ignore it I think - it doesn't affect the game's behavior.

    Now, if you want to remove it, you can add this code at the start of the ShakingCamera.reset_smoothing_speed() function:

    func reset_smoothing_speed() -> void:
    if Engine.editor_hint:
    return

    The editor_hint property tells you if code is running in the context of the editor, allowing you to run some code only in the editor or only at runtime. Which we sometimes need for tool scripts.

  • Nathan Lovato replied

    Note I'm saying it's a strange error because I don't see why the function runs at all. This error may have started appearing with a recent Godot version - I don't remember seeing it back when making the course (was with Godot 3.1 I think).