0 votes

HI
I need to write plugin for my godot project to automat few operations.
Everything seems to works correctly with one issue:

After changing active scene tab I need to edit script (add random space in empty line or something like that) and save it, to make it working correctly, otherwise (after chaning tab without editing) it's outputs error:

res://addons/RoshamboManager/roshambo_manager.gd:219 - Invalid call. Nonexistent function 'get_children' in base 'Nil

I think the problem is with function:

get_tree().get_edited_scene_root()

How to solve that?

in Engine by (230 points)
edited by

2 Answers

0 votes
Best answer

I re-read your question and realized that I missed something. If your not using the signal "scene_changed" from EditorPlugin then you should.

by (1,032 points)
selected by

Can you explain how to use this signal? I'm trying to analise other plugin and documentation but I can't find any comprehensive example :(

Using the connect function (https://godot.readthedocs.io/en/latest/classes/class_object.html#class-object-connect) you can connect a signal to your own function and therefore execute custom codes when this event occur.

Signal are not specific to plugins.

0 votes

What is the type of roshambo_manager.gd and also how do you access it? As a singleton?

by (1,032 points)

It's a plugin script created like in this tutoral (dock section): http://docs.godotengine.org/en/3.0/tutorials/plugins/editor/making_plugins.html

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 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 webmaster@godotengine.org with your username.

Categories