Editor doesn't save a node's position

Godot Version

4.3.stable

Question

I have a player scene named PlayerBody2d (characterbody2d). I added this to my main.tscn scene.

When I change the position in “main.tscn”, it just resets it position to (0,0). It’s not a runtime issue this is happening in the editor.

  • When I checked the scene file (tscn) it literally doesn’t modify it. So I change the position, Editor shows it but if I close and open the scene, or run the game it just resets to 0,0.
  • I checked tscn file in a text editor, and position gets remove, and file is never modified even though I moved the PlayerBody2d and saved it. tscn file doesn’t get modified.
  • If I manually add the position to tscn file, then open up the editor, it again resets it! and deletes the line.
  • It’s same when I import it to other scenes, it’s not just the main scene.
  • All other objects / nodes behave as expected and saves their position etc.
  • When I change skew or scale it works! But position doesn’t work.

I’m going crazy. I tried make it “Editable Children” and “Make Local”, even then it doesn’t work!!!

Any ideas?

OK. I’ve solved this by brute force.

It turns out there an AnimationPlayer that used this object, and for whatever reason it was causing this bug. Once I deleted the AnimationPlayer, problem is fixed.

It seems like a bug in the editor, as I didn’t have any @tool code and it clearly caused an issue in the editor itself. If anyone else runs into it :slight_smile:

AnimationPlayers may have a RESET track that is run when the scene is saved, your AnimationPlayer may have had a position (0,0) key on it’s RESET animation.

I’m pretty sure this was the case! Thanks for this, I’ll keep this in mind. I’d never thought that RESET track to trigger on every save.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.