How to edit Inherited Packed Scenes

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By afk_mario

I want to change the collision_layer and collision_mask of all packed scenes in a folder, I managed to accomplish this with the following code:

The issue is that if the scene inherits form a GLTF scene, when I modify and save the packed scene the inheritance is broken.

I would to know also.

VanDeiMin | 2022-02-06 02:37

:bust_in_silhouette: Reply From: VanDeiMin

I found an answer.
When You instance scene from code, You Have to set GenEditState to GEN_EDIT_STATE_INSTANCE = 1
Be aware that works only from editor. But Your code is “tool” so I suppose it can work.

var scene : PackedScene = load("res://path")
var node : Node = scene.instance(GEN_EDIT_STATE_INSTANCE)

Thanks don’t know how I missed that!

afk_mario | 2022-02-06 18:50