Hey,
I'm desesperatly trying to build a plugin to edit my custom resource.
Here's my custom resource class:
using Godot;
using System;
public class ResourceTest : Resource
{
}
And the plugin code:
#if TOOLS
using Godot;
using System;
[Tool]
public class MyPlugin : EditorPlugin
{
public override void _EnterTree()
{
AddCustomType("ResourceTest", "Resource", GD.Load<Script>("res://ResourceTest.cs"), null);
}
public override void _ExitTree()
{
RemoveCustomType("ResourceTest");
}
public override bool Handles(Godot.Object @object)
{
//here @object is always a Resource and never a ResourceTest
return base.Handles(@object);
}
}
#endif
The problem is: the @object parameter in the Handles function is never a ResourceTest, even when I actually open a ResourceTest in the editor, its class is always Resource and I can't cast it to ResourceTest. It's like the resource object lost its base class in the process. How can I do?
Thanks in advance for your help!