My gun was firing every frame instead of accounting for recoil, no matter how large I set the recoil value to be. I assumed it was broken. I spent about 30 min rearranging code trying to figure out why it wasn't working, when I remembered. The recoil value is exported, and in the gun scene I had the value changed, so it didn't matter what value I set in my script. The value was 0 in my scene, so it fired every frame.

I feel stupid, but this is a normal feeling for most coders, so I'm not too worried about it . Let that teach me to think more when I'm using exported variables.

I have an export var "id" for my draggable game objects. In the script idk what I did- maybe just copy and pasted that var to another line. No I think what I did was rename the var from objectID to just id. I realized when the game loaded nothing but floor that something had gotten messed up- sure enough had to reset each and every one of those darn id numbers.

Now I wonder if there's a way to ... safely? edit those export vars. Heck lemme just test and find out! Copy and pasting the line? No worries! The assigned value sticks. Renaming the variable name manually or with the replace tool? Goodbye assigned value! Changing the data type from, for example, int to float? See ya later var you hater!

I was once writing a matrix math library, and the transpose function wasn't working. I spent days debugging it and couldn't figure it out. Then I was randomly at work in the bathroom and the answer came to me. I was trying to swap values around without a temporary variable. So it was something like this:

element_12 = element_21
element_21 = element_12

Which obviously would never work (the real code had 16 variables in a loop, so it was not as obvious as the above example, but same idea). I got home and changed it and it worked.

4 days later

A person posted a code somewhere asking why it didn't work. He then answered himself like just changing var a = 1 to a = 1 (simple fix like that) then mentioned he feel kinda dumb and need a sleep.

I read it and thought cool a working code let me try it. But It didn't work and after a day or two I decided to post here asking for help.

Twigleg (?) then replied I should change var a = 1 to a = 1..

So basically I used the original broken code and totally forgot the fix

@Gowydot said: A person posted a code somewhere asking why it didn't work. He then answered himself like just changing var a = 1 to a = 1 (simple fix like that) then mentioned he feel kinda dumb and need a sleep.

I read it and thought cool a working code let me try it. But It didn't work and after a day or two I decided to post here asking for help.

Twigleg (?) then replied I should change var a = 1 to a = 1..

So basically I used the original broken code and totally forgot the fix

uh, am I just confused? because a = 1 is the same thing as a = 1.

However, that's hillarious, thnx for sharing.

@OpinionatedGamer just means the variable was already initialized. @Gowydot that’s a really good one

Just a couple days ago I was having an issue where I couldn’t figure out why a value wasn’t working and it was the same issue that @OpinionatedGamer had, it was an exported variable and I didn’t change the exported value. :lol: Makes me feel silly when I realize it was something so simple, especially after peppering the code with print statements trying to debug where the value was off.

@Gowydot said Twigleg (?) then replied I should change var a = 1 to a = 1..

I’m not positive, but I think it was a local variable shadowing a class variable with the same name, but I do not remember and I might be remembering a different issue on a different post. The important part is a solution was found :)

@OpinionatedGamer said: uh, am I just confused? because a = 1 is the same thing as a = 1.

I remember from top of my head being simple fix similar to that. The actual thread is here

func _on_WaterArea_body_entered(body):
var onwater = true
to
onwater = true
6 days later

Couple of days ago, after lamenting strongly against yields on the forum, I found a game crashing yield buried in the lower dungeons of my code.

a year later

Recently I was dividing by an exported int in a tool script and forgot to change it off zero before reloading the scene, which crashed godot instantly, but the project was saved with that scene open, making godot crash immediately on opening the project.

luckily it was a small test project


Completely unrelated, but i also somehow managed to delete my entire Documents folder without noticing.

12 days later

My favorite trick? Don't use exported values. I'm really bad at keeping track of that many faults, so I don't.