godotengine / godotengine/godot-docs
It is not clear how EditorResourcePicker should be used
- Dominant language
- reStructuredText
- Stars
- 5.7k
- Forks
- 3.8k
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 25
Description
**Your Godot version:**
Godot 3.4.4.stable
**Issue description:**
The documentation for EditorResourcePicker states that:
> Note: This [Control](https://docs.godotengine.org/en/stable/classes/class_control.html#class-control) does not include any editor for the resource, as editing is controlled by the Inspector dock itself or sub-Inspectors.
But it doesn't explain or give an example of how to make the inspector or sub-inspector edit the resource in question, and specially how to open the resource when clicked.
I was able to figure out I had to connect to the `resource_changed` signal in the parent `EditorProperty` to be able to actually edit the property, and that wasn't so hard.
Then I figured to open the resource in the inspector, I needed to use the `resource_selected` signal from `EditorResourcePicker` and connected it to a function in the parent `EditorProperty`.
In the connected function I call:
```
emit_signal("resource_selected", get_edited_property(), resource)
```
This is the `resource_selected` signal from `EditorProperty` and it does open the Custom Resource in the editor like this:

But I can't open it as a sub-inspector, like I can when I just export it as a regular Resource.
The documentation for this `resource_selected` signal is also a bit confusing, it says:
> resource_selected(path: String, resource: Resource)
If you want a sub-resource to be edited, emit this signal with the resource.
But what is path supposed to be? I'm passing `EditorProperty.get_edited_property()` to it, but it doesn't really seem to matter, as it works exactly the same way whatever I pass to it. I can leave it as an empty string or pass complete garbage to it like this:
```
emit_signal("resource_selected", "heuhueh", resource)
```
And it will still work exactly the same.
The only place in the documentation I found any mention of sub-inspectors was the signal `object_id_selected(property: String, id: int)` from `EditorProperty`, but if I do:
```
emit_signal("object_id_selected", _property_path, resource.get_instance_id())
```
I get this error:
> error core/io/packet_peer.cpp:254 - Condition "peer.is_null()" is true. Returned: ERR_UNCONFIGURED
So I guess I'm clearly using it wrong.
Anyway, I'm really lost here.
**URL to the documentation page (if already existing):**
[EditorResourcePicker](https://docs.godotengine.org/en/stable/classes/class_editorresourcepicker.html?highlight=EditorResourcePicker)
[EditorProperty signals](https://docs.godotengine.org/en/stable/classes/class_editorproperty.html?highlight=EditorProperty#signals)
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.