# Not sure how to store a tree like structure

**URL:** <https://forums.unrealengine.com/t/not-sure-how-to-store-a-tree-like-structure/365812>\
**Category:** C++\
**Tags:** data-structures, unreal-engine, UE4, CPP, question\
**Created:** [August 1, 2016, 5:56pm UTC](https://forums.unrealengine.com/t/not-sure-how-to-store-a-tree-like-structure/365812 "2016-08-01T17:56:30Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![thesonglessbird](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@thesonglessbird](https://forums.unrealengine.com/u/thesonglessbird)\
**Post date:** [August 1, 2016, 5:56pm UTC](https://forums.unrealengine.com/t/not-sure-how-to-store-a-tree-like-structure/365812/1 "2016-08-01T17:56:30Z")

</div>

I come from a Javascript background and I’m new to C++ and Unreal Engine so I may well be approaching this in the wrong way but my problem is as follows:

I have a class that’s loading in a number of static meshes and storing pointers to them in a TArray. I need to store these pointers in more of a structured way that basically mimics the folder structure they’re stored in. Something like this:

BuildingPieces-\>City-\>Tower01-\>Top-\>City\_Tower01\_Top01

BuildingPieces-\>Industrial-\>Factory04-\>Middle-\>Industrial\_Factory04\_Middle08

BuildingPieces-\>Slums-\>TowerBlock02-\>Bottom-\>Slums\_TowerBlock02\_Bottom02

etc.

I’m totally stuck as to which collection types to use and when. It seems like a combination of TArrays, TMaps and structs would maybe do it but I’m lost!

---

<div class="post-metadata">

**Author:** ![BrUnO\_XaVIeR](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/bruno_xavier/32/1110230_2.png) [@BrUnO\_XaVIeR](https://forums.unrealengine.com/u/BrUnO_XaVIeR)\
**Post date:** [August 1, 2016, 6:16pm UTC](https://forums.unrealengine.com/t/not-sure-how-to-store-a-tree-like-structure/365812/2 "2016-08-01T18:16:02Z")

</div>

Hold pointers to UObjects;  
UObjects can hold pointers to other objects, so then with them is easy to achieve the tree behavior you want.
