All Questions

Community

M
Kimberly Metz(teamheartcode)

Nonexistent function 'calculate_grid_coordinates'

Hi,

when opening the main scene at this point of the tutorial in the editor, I'm getting the following two errors:

res://Unit.gd:59 - Invalid call. Nonexistent function 'calculate_grid_coordinates' in base 'Resource (Grid.gd)'.
res://Cursor.gd:34 - Invalid call. Nonexistent function 'calculate_map_position' in base 'Resource (Grid.gd)'.

When running the game, these errors do not occur. In other words, when removing the 'tool' keywords in Unit.gd and Cursor.gd makes the error message go away. So it seems  when running with 'tool' in the editor, it's unable to access the grid resource.

Also, as logical result, I can't see for example any preview of the drawn cursor in the editor because both these scripts crash in the _ready() function when run in editor.

It's weird, because print(grid) at the start of _ready() says grid is not null, but something like [Resource:19816].

Any advise on that? Thanks!

  • GDQuestions replied

    I just tested in Godot 3.4 and indeed, this is happening now. I think it's an issue introduced by Godot 3.4 as this didn't happen before. For now, you can remove the tool keyword.

    Resources have some quirks like that. Some contributors have been looking into addressing many underlying issues, but I don't know if they're compatibility-breaking or something as that didn't get merged yet.