- Home /
Extract a Tree layout in text of the UI Prefab
A project I am inheriting has a large UI prefab and I want to make a text based list of each named element.
How can I export the prefab so I am left with a text file or "tree" of the connections/assets involved.
P.S. thanks in advance.
Answer by Harinezumi · Oct 23, 2017 at 07:41 AM
Here is a question that partly solves what you want.
I would iterate through all the children of the prefab depth-first, storing the elements I still need to visit in a Stack. You will also need a "global" variable to store the current tree depth for printing the tree, increased whenever you go deeper into the tree, and decreasing whenever you return. Then you can print the name of the GameObject and, using the above example, all the Components on it. You could specify for certain types to print certain variables, e.g. Sprite name for an image. However, it is rather difficult if your prefab has other prefabs in it, for that you would need to process the prefab's file in text mode.
If you need more details, code example, just write.
Your answer
Follow this Question
Related Questions
Editor : dynamic asset creation and prefabs, best practice ? 1 Answer
prefab question 1 Answer
Edit Prefab, Instantiate, Access Array in Clone 1 Answer
Changing GUITEXT Value... 0 Answers
GUI and buttons 3 Answers