Godot Version
godot 4.4.1-stable
Question
I want to make a custom node to substitute ItemList in short, making it more flexible with it allowing its items to be anything you can make with control nodes, letting the container structure handle it all. I’m doing a project where I have multiple places where this same structure appears: I have a list of things (that are made of other control nodes) and I need this to be scrollable and each item be selectable.
I managed to make it work with a ScrollContainer and a GridContainer inside, and a packaged scene to replicate and change specific things (like swapping the texture of each item and assigning a custom resource to do logic). This works, but I see a clear structure that could be replicated, and I wish I could just abstract this all into a “custom control node” of sorts, to make the overall process of implementing is easier.
The way I attempted to do this is by having a tool script on the root of the scroll container that checks for all child nodes that aren’t the grid and adds them inside an instance of a wrapper scene that holds them in place (to keep the grid structure and implement the button features). It seems to work fine, but when I tried adding random control nodes to test it and save it later, it would always fail. It seems to be some issue related to ownership of nodes, which I can’t find a way around. I think this is solution is clever, but it’s really buggy due to godot’s structure and the way it handles saving scenes.
I’m probably going to use the first approach (which worked), but I would like to know if there’s a better way to make this special node in a modular way, to be able to use it in different situations and not have to implement it all over.
EDIT: I figured since I explained it poorly I should just show it instead.