Hello! I am trying to utilize GDScript to tell the engine to find the directory location of an object's tscn file or res file.
This is what I thought might work when you place it in an autoload script as a function:
var fetcher = EditorFileSystemDirectory.new()
It was a theory in thought that "idx"is the node or object you want to fetch the id off from (i.e. [Node:####]) using
get_instance_id(), then after starting the
EditorFileSystemDirectory as new I could use use
get_file_path() command to get the directory path (ex. res://path/to/file.tscn)
I did get a print when using get file path, and it didn't come out right when the file I wanted is in a folder
"res://", also I ended up with this error:
0:00:02:0130 - Index p_idx=1289 out of size (files.size()=0)
C Error: Index p_idx=1289 out of size (files.size()=0)
C Source: editor\editor_file_system.cpp:87
C Function: EditorFileSystemDirectory::get_file
1289 is one of many instance ids for an object (####), and for some reason it says it's out of size.
I wouldn't be surprised that this is not the way to fetch the filepath of an object but unless there is a better way to do it I'm open for ideas.