So I need kind a prefab for structure like this:
Visual element
- Button
- Visual element
– RootImage (Repeat this 11 more times)
— SubImage
— SubImage
— SubImage
So right now i use this to copy this structure:
public static VisualElement Clone (this VisualElement original, VisualTreeAsset originalTreeAsset)
{
return originalTreeAsset.CloneTree().Q<VisualElement>(original.name);
}
Is there more efficient way to do it?
Because right now to use it like a prefab (edit in context of other UI in UIBuilder) i need to keep it in main UIDocument.
And this means each time i need to instantiate this structure i need to instantiate whole VisualTreeAsset move that structure to my main tree and pray all the gods that GC will kill duplicate tree soon enough.
PS Is there any plans to create prefab system for UIBuilder?