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?

asked Mar 27, 2018 in Engine by websterek (229 points)
edited Apr 29, 2018 by websterek

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.

answered Mar 27, 2018 by BraindeadBZH (1,020 points)
selected Apr 1, 2018 by websterek

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?

answered Mar 27, 2018 by BraindeadBZH (1,020 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.