0 votes

Hello everyone!

I am trying to create custom CheckBox using this article https://docs.godotengine.org/ru/stable/tutorials/plugins/editor/making_plugins.html#about-plugins

I have created a file res://addons/rgCheckBox/rgCheckBox.gd:

tool
extends CheckBox
class_name rgCheckBox

func _ready():
    pass

I have created a file res://addons/rgCheckBox/custom_node.gd:

tool
extends EditorPlugin

func _enter_tree():
    add_custom_type("rgCheckBox", "CheckBox", preload("rgCheckBox.gd"), preload("icon.png"))

func _exit_tree():
    remove_custom_type("rgCheckBox")

The problems:
1) I can not see rgChechBox in Editor control list
2) When I try to enable this custom component in [Project] > [Project Settings...] > [Plugins] then I get the message

Unable to load addon script from path: 'res://addons/rgCheckBox/rgCheckBox.gd' Base type is not EditorPlugin.

As I understand in Godot script multiple inheritance is not supported (or is supported but I did not find this syntax) - so how can I inherit my custom component from EditorPlugin and standard UI component in the same time? Or what am I generally doing wrong?

Thanks in advance

Godot version Godot 3.5
in Engine by (16 points)

1 Answer

0 votes

Problem

You have set up your plugin configuration in custom_node.gd and as such this is what your plugin file should point to

Solution

In your plugin.cfg file change the line

script="rgCheckBox.gd"

to

script="custom_node.gd"

Notes

To prevent the error in future name your config file as plugin.gd or a naming scheme like
custom_node.gd
custom_plugin.gd

by (6,876 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.