Godot Version
4.7.2
Question
I'm trying to understand why when I right click "Open" on the script or double click it nothing shows up? I can open up player.gd in a text editor and it has code in it. What is going on?
Hi there!
What’s the code in the file? Anything out of the ordinary in that file? Could you paste the content?
Was it working before?
If yes, what did you change between the moment it worked and the moment you figured out it stopped working?
I’am having the same issue, but with newly created .tres files. The only solution i have found is to make a .gd script and save it as a .tres.
It’s the default player movement code.
I’ve removed the script and added multiple times and tried different things but yeah ![]()
It may be slightly edited from earlier but yeah I think just the consts
extends CharacterBody2D
const SPEED = 300.0
const JUMP_VELOCITY = -400.0
func _physics_process(delta: float) -> void:
# Add the gravity.
if not is_on_floor():
velocity += get_gravity() * delta
# Handle jump.
if Input.is_action_just_pressed("ui_accept") and is_on_floor():
velocity.y = JUMP_VELOCITY
# Get the input direction and handle the movement/deceleration.
# As good practice, you should replace UI actions with custom gameplay actions.
var direction := Input.get_axis("ui_left", "ui_right")
if direction:
velocity.x = direction * SPEED
else:
velocity.x = move_toward(velocity.x, 0, SPEED)
move_and_slide()
How did you add and remove the script?
Usually it is a good idea to left click the filesystem tab (see below) for doing things like renaming, moving, etc.
The best moment to do renames, moves and other operations to your files and directories is at a time when Godot can parse your project code.
Godot tracks almost anything you do to your nodes and scripts in the TRES files – or UID files or in the project config. These three places are where I would look first. Sometimes a reference to a such an item can get messed up.
The UID which got created for your script in the UID file next to your script should match the UID in the TSCN file where your script is attached.
For example a script attached to a node might have this structure:
.
├── game_creator_ui.gd
├── game_creator_ui.gd.uid
└── game_creator_ui.tscn
Where game_creator_ui.gd is just a regular script which extends Control and does some script stuff.
The file game_creator_ui.gd.uid only contains one line and that looks something like this: uid://coxh4l0o1pcpw. It defines that scripts UID.
The file game_creator_ui.tscn contains different things the scene tree has, but also it contains one line referencing the script file:
[gd_scene format=3 uid="uid://..."]
[ext_resource type="Script" uid="uid://coxh4l0o1pcpw" path="res://code/packages/game_creator_ui/game_creator_ui.gd" id="..."]
[sub_resource type="StyleBoxEmpty" id="..."]
... more stuff in this scene.
I would make sure your project follows a similar structure.
If you cannot figure out if the references are broken or the reason for this not to work, I try to start from zero: delete the scripts and the scene – save them outside the project first – and then add brand new nodes and scripts.
Another general approach is to go back to a state in your version control where everything was working and figure out what changed from there.
I was doing everything from the GoDot UI. So when I removed the file I right clicked it in the bottom left of GoDot UI and deleted it that way. I thought maybe it was empty and I only know it has code in it since I decided to open it up in another editor.
So added it where the “Remove Script” is now there was an “Add Script” button, that’s how I originally added it. And I removed it using that, and deleted the file through the FileSystem in GoDot like in this image.
Did you change your default script editor in the project settings?
Also, what is the exact version you are using? Godot had a major change in the editor docks on the most recent dev release.
Try going back one version if you are using that.
I have no idea how GODOT handles external editors and whether or not this is a bug.
Try it on a blank project and if it is repeatable then post a possible bug to GODOT github issues describing how you think it should be handled.
Follow the reporting guidelines.
That does not look like an error on the Godot side for me.
If you setup an external editor, the expected behavior should be that the file will be opened with an external editor. Why do you expect it to open in the internal editor (too)?
I’m not sure if Godot currently notifies you if the path to the executable does not work correctly. Imho that could help avoid confusion.