# How does one access tiles?

**URL:** https://community.cesium.com/t/how-does-one-access-tiles/20223
**Category:** Cesium for Unreal
**Created:** [September 2, 2022, 8:04am UTC](https://community.cesium.com/t/how-does-one-access-tiles/20223 "2022-09-02T08:04:54Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Alexander\_Drozdoff](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/alexander_drozdoff/32/9436_2.png) [@Alexander\_Drozdoff](https://community.cesium.com/u/Alexander_Drozdoff)
#### Post date: [September 2, 2022, 8:04am UTC](https://community.cesium.com/t/how-does-one-access-tiles/20223/1 "2022-09-02T08:04:54Z")

</div>

Let’s say we want to add something dynamically to the tile material instance.  
How does one accesses the tiles? So far i can access one tile(as PrimitiveComponent) via linetrace, and that’s it.  
`void forEachLoadedTile(const std::function<void(Tile& tile)>& callback);` just crashes with nullptr on head, presumably because you need to call it when tiles have loaded, but i can’t find anything to synchronize on that time-point.

Is there some unreal way to access tiles? Various GetComponent() methods return unreal-level components of the actor, not parts of the tileset.

---

<div class="post-metadata">

### Author: ![Nithin\_Pranesh](https://avatars.discourse-cdn.com/v4/letter/n/ecd19e/32.png) [@Nithin\_Pranesh](https://community.cesium.com/u/Nithin_Pranesh)
#### Post date: [September 2, 2022, 6:30pm UTC](https://community.cesium.com/t/how-does-one-access-tiles/20223/2 "2022-09-02T18:30:34Z")

</div>

Hi @Alexander_Drozdoff,

I think you should be able to retrieve the material instance through Unreal APIs alone, right? You can do `GetMaterial(0)` on the `UPrimitiveComponent`. You can cast that to a `UMaterialInstanceDynamic` and then you should be able to set scalar / vector / texture paramaters on it that you can access in the custom tileset material. I don’t think you’ll need any Cesium API to retrieve and manipulate the material instances, but let me know if that’s not the case.

-Nithin

---

<div class="post-metadata">

### Author: ![Alexander\_Drozdoff](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/alexander_drozdoff/32/9436_2.png) [@Alexander\_Drozdoff](https://community.cesium.com/u/Alexander_Drozdoff)
#### Post date: [September 5, 2022, 12:51am UTC](https://community.cesium.com/t/how-does-one-access-tiles/20223/3 "2022-09-05T00:51:42Z")

</div>

@Nithin_Pranesh Yes, but how do i access all `UPrimitiveComponent`s of a tileset?

---

<div class="post-metadata">

### Author: ![Alexander\_Drozdoff](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/alexander_drozdoff/32/9436_2.png) [@Alexander\_Drozdoff](https://community.cesium.com/u/Alexander_Drozdoff)
#### Post date: [September 8, 2022, 7:27am UTC](https://community.cesium.com/t/how-does-one-access-tiles/20223/4 "2022-09-08T07:27:32Z")

</div>

So, does anyone else knows how to do this?

I just want to get `UPrimitiveComponent` like you access one through LineTrace return, but i want to access all of them iteratively. Cesium’s method for that crashes with nullptr.

---

<div class="post-metadata">

### Author: ![Alexander\_Drozdoff](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/alexander_drozdoff/32/9436_2.png) [@Alexander\_Drozdoff](https://community.cesium.com/u/Alexander_Drozdoff)
#### Post date: [September 11, 2022, 11:56pm UTC](https://community.cesium.com/t/how-does-one-access-tiles/20223/5 "2022-09-11T23:56:08Z")

</div>

@Kevin_Ring maybe you know something about this?

---

<div class="post-metadata">

### Author: ![Kevin\_Ring](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/kevin_ring/32/2003_2.png) [@Kevin\_Ring](https://community.cesium.com/u/Kevin_Ring)
#### Post date: [September 12, 2022, 12:32am UTC](https://community.cesium.com/t/how-does-one-access-tiles/20223/6 "2022-09-12T00:32:05Z")

</div>

Sure, there’s not really any Cesium-specific trick to it, just use the normal methods to ask Unreal for the ActorComponents you want. Something like:

```auto
  TArray<UCesiumGltfPrimitiveComponent*> components;
  TilesetActor->GetComponents<UCesiumGltfPrimitiveComponent>(components);

```
