Discuss Scratch
- Discussion Forums
- » Bugs and Glitches
- » Warning doesn't appear when deleting variables with only one use
- hedgehog_blue
-
Scratcher
1000+ posts
Warning doesn't appear when deleting variables with only one use
Warning doesn't appear when deleting variables with only one use
If a variable only has one use in a project, then when you try to delete it, it does not warn you.
If you have 2 or more uses of the variable, it does warn you and you can choose to cancel.
It seems like it is supposed to also warn you if there is one use.
Although it seems like a small bug, it caused big problems. This just happened to me (I was replacing variables to make them ‘for this sprite only’ and was deleting the old ‘for all sprites’ variables), and it caused an error in my project that took a while to find, and the broken code made lose some data in lists that would be deleted based on that variable.
How to get this bug to occur:
• Create a new project
• Take out 1 variable block
• Delete the variable
What should happen:
It warns you that there is one use of the variable so you can cancel.
What does happen:
Warning does not appear and the use of the variable is deleted instantly.
Here's a gif of deleting variables with 2 or more uses. You can see it warns you:

Here's a gif of deleting variables with 1 use. You can see it doesn't warn you:

Edit:
I think this happens because you can also delete variables from the input on the set block (I don't know why, I guess it's convenient?), so it assumes you are deleting from the instance itself.
If a variable only has one use in a project, then when you try to delete it, it does not warn you.
If you have 2 or more uses of the variable, it does warn you and you can choose to cancel.
It seems like it is supposed to also warn you if there is one use.
Although it seems like a small bug, it caused big problems. This just happened to me (I was replacing variables to make them ‘for this sprite only’ and was deleting the old ‘for all sprites’ variables), and it caused an error in my project that took a while to find, and the broken code made lose some data in lists that would be deleted based on that variable.
How to get this bug to occur:
• Create a new project
• Take out 1 variable block
• Delete the variable
What should happen:
It warns you that there is one use of the variable so you can cancel.
What does happen:
Warning does not appear and the use of the variable is deleted instantly.
Here's a gif of deleting variables with 2 or more uses. You can see it warns you:

Here's a gif of deleting variables with 1 use. You can see it doesn't warn you:

Edit:
I think this happens because you can also delete variables from the input on the set block (I don't know why, I guess it's convenient?), so it assumes you are deleting from the instance itself.
DETAILS
Bug first found: 2019-08-03
Bug reported: 2019-08-03
Bug last confirmed: 2021-12-19
Not fixed for 2 years, 4 months, 16 days
Last edited by hedgehog_blue (Dec. 20, 2021 05:54:35)
- WaterComesBack
-
Scratcher
100+ posts
Warning doesn't appear when deleting variables with only one use
What does happen:Once I read that, this could be an older feature of 2.0.
Warning does not appear and the use of the variable is deleted instantly.
I check using the offline editor for Scratch 2.0, and indeed this is an older feature of 2.0 that was later removed in 3.0.
So, this is not a bug, it was a feature in 2.0 that was deleted in 3.0
If you would like to suggest it to come back please use the suggestion forum.
Last edited by WaterComesBack (Aug. 3, 2019 23:44:55)
- hedgehog_blue
-
Scratcher
1000+ posts
Warning doesn't appear when deleting variables with only one use
I don't understand what you mean.What does happen:Once I read that, this could be an older feature of 2.0.
Warning does not appear and the use of the variable is deleted instantly.
I check using the offline editor for Scratch 2.0, and indeed this is an older feature of 2.0 that was later removed in 3.0.
So, this is not a bug, it was a feature in 2.0 that was deleted in 3.0
If you would like to suggest it to come back please use the suggestion forum.
Just because a bug used to not exist doesn't mean it becomes a suggestion.
Edit:
I think I understand now; it looks like you judged the post based on that one sentence and thought the warning feature was removed entirely in 3.0.
Read the rest of the post and you'll see that it still does warn you when you delete variables, but doesn't when there is only one use. Hopefully now you understand that this is just a small bug, rather than a suggestion for a whole new feature.
Last edited by hedgehog_blue (Aug. 4, 2019 19:56:24)
- hedgehog_blue
-
Scratcher
1000+ posts
Warning doesn't appear when deleting variables with only one use
Update: This bug isn't too urgent, because I have found a way to deal with it. Just make sure to take out another use of the variable before deleting it, and if there was one use, it is now 2 uses and will warn you. Not a perfect solution, but it makes the over 8 month wait for this bug to be fixed more bearable.
- Discussion Forums
- » Bugs and Glitches
-
» Warning doesn't appear when deleting variables with only one use

