-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extension Best Practices #70
Comments
That's a good convention, also if you can put most of the variable inside a single structure variable with the name of your extension (and an underscore in front of it), that should greatly reduce the risk of conflicts.
Yes, that's the risk. If you see an extension that uses a fairly obvious/common variable name, let me know and feel free to submit an updated extension.
There is no easy way to remove a variable outside of a structure, which is kind of per design (in a game you avoid creating and destroying variables too much if you can). I think it's ok because it's giving at least one hint in the debugger to the end user that this variable was created and used - so you must be careful about not using it. I think the proper answer to this would be to add support "extension variable" (with actions/conditions/expressions for variables scoped to extensions). With this, no more risk of conflict at all. I've created a card for this here: https://trello.com/c/CWL7Z9jB/463-add-support-for-extension-variables That's the cleanest solution. In the meantime, let's be sure to use variables with a long prefix to avoid collisions :) |
I like your solutions, both short-term (unique names or a single structure with child variables) and long-term (variables that only exist inside the extension). Thanks! |
Closing this as we have the checklist now :) |
➡️ See the checklist of the best practices here ⬅️
Original discussion:
I have realized that the scene variables used in my extension are not locally scoped inside the extension. Instead, they share the same space that all scene variables share. This means that some of my simple names for scene variables could collide with something that the GDevelop user has assigned.
Can you provide guidance on how variables should be named when used inside an extension? Someone gave an example that looked like this:
"_MyExtensionMyVariableName"
Is there any way to delete temporary scene variables that were used in an extension? (These should still follow the naming convention to prevent accidental overwriting and deletion)
The text was updated successfully, but these errors were encountered: