Search Unity

Clone a C# created hierarchy?

Discussion in 'UI Toolkit' started by Guedez, Jul 7, 2020.

  1. Guedez

    Guedez

    Joined:
    Jun 1, 2012
    Posts:
    827
    Should I make a method that generates said hierarchy when I need it, or there is a way to 'cache' it and clone on demand?
    I see that it's easy to do with UXML hierarchies, but I couldn't figure out the equivalent for C# created ones
     
  2. uDamian

    uDamian

    Unity Technologies

    Joined:
    Dec 11, 2017
    Posts:
    1,231
    There is no such clone feature. This is exactly what UXML was made for - cloning. The only C# alternative is indeed, as you said, a function that generates a hierarchy.