Skip to content

Improve undeclared variables tip in the variable editor #6412

Open
@AlexandreSi

Description

@AlexandreSi

Description

When editing Global/Scene/Object variables, there's a tip explaining that some variables are used in the event sheet but are not declared. While this is useful to detect misuses or clean a project's variables use, it doesn't work perfectly well because it doesn't take into account the refactoring: if you have a variable TotalGold that is used in the events sheet and decide to rename it Gold, the tip will appear telling you that the variable TotalGold is not declared.

Also, the tips appear in the instance variables but I'm not sure it's useful there. Or it should say that the variable XXX is not declared and that it should be changed at the object level, not the instance level.

Solution suggested

The tip should take into account that the refactoring will rename the variables in the events sheet and then should display nothing.

Technically speaking, I think that on each renaming operation, the changeset should be computed and use the oldToNewVariableNames data structure to know if some variables are truly undeclared or not.
The changeset is currently a struct in C++ and might need to be converted into a class in order to be used by Javascript.

Metadata

Metadata

Assignees

No one assigned

    Labels

    👌good first issueGood issue if you want to start contributing to GDevelop😤Non optimal UIA bug/issue where the UI is usable but not optimal

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions