0 votes

I have a GridMap extending tool script. I populate grid with mesh intances, and when I set save var to true GridMap is supposed to save placeholders locations and data into file. That works. The same goes for loading, when it is set to true, GridMap is reading saved file, and its child serving as container ( Spatial ) is supposed to add_child of recreated mesh instances placeholders.

Problem is, upon loading, placeholders are recreated but not seen as children of Spatial node. They are visible on the map, I suspect they are orphaned, perhaps only "placeholder.new()" code was resolved, without "Spatial.add_child()". No error is shown in console, visible mesh instances are unselectable in editor. I menaged to redo tool code, so I get references to placeholders into array, and clearing this array in setget tool script is the only way to get rid of those orphans.

I have avoided using tool in the past. Can anyone recognize this issue ? Is adding children in tool script bad practice ?

Godot version godot 3.2 stable
in Engine by (7,205 points)

Please log in or register to answer this question.

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.