# How to modify UVs during runtime?

**URL:** <https://community.cesium.com/t/how-to-modify-uvs-during-runtime/27238>\
**Category:** Cesium for Unreal\
**Created:** [October 9, 2023, 6:36am UTC](https://community.cesium.com/t/how-to-modify-uvs-during-runtime/27238 "2023-10-09T06:36:27Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ycn2022](https://avatars.discourse-cdn.com/v4/letter/y/b5ac83/32.png) [@ycn2022](https://community.cesium.com/u/ycn2022)\
**Post date:** [October 9, 2023, 6:36am UTC](https://community.cesium.com/t/how-to-modify-uvs-during-runtime/27238/1 "2023-10-09T06:36:27Z")

</div>

I want to dynamically set the material of the model, and a solution is to modify the UVs of the vertices at runtime. What can I do to modify vertex UV values

---

<div class="post-metadata">

**Author:** ![janine](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/janine/32/5135_2.png) [@janine](https://community.cesium.com/u/janine)\
**Post date:** [October 9, 2023, 5:23pm UTC](https://community.cesium.com/t/how-to-modify-uvs-during-runtime/27238/2 "2023-10-09T17:23:59Z")

</div>

Why are you trying to modify vertex UV values to change a material? The [`SetMaterial`](https://docs.unrealengine.com/5.0/en-US/BlueprintAPI/Rendering/Material/SetMaterial/) Blueprint exists; you can iterate over all of the `CesiumGltfPrimitiveComponent`s of a `Cesium3DTileset` and change their material. There is also a `SetMaterial` Blueprint on the `Cesium3DTileset` itself.

If you really don’t want to call this function, then at least change a parameter of the material itself instead of modifying UVs. For example, you can create a scalar parameter, then use [`SetScalarParameterValue`](https://docs.unrealengine.com/5.0/en-US/BlueprintAPI/Rendering/Material/SetScalarParameterValue/) to set it. Changing the UVs can break some features of the `Cesium3DTileset`, including textures, feature IDs, and raster overlays.

---

<div class="post-metadata">

**Author:** ![ycn2022](https://avatars.discourse-cdn.com/v4/letter/y/b5ac83/32.png) [@ycn2022](https://community.cesium.com/u/ycn2022)\
**Post date:** [October 10, 2023, 12:54am UTC](https://community.cesium.com/t/how-to-modify-uvs-during-runtime/27238/3 "2023-10-10T00:54:44Z")

</div>

OK, What I ultimately achieved was highlighting multiple objects by clicking with the mouse. Actually, I pass a new texture as a parameter to the material to do this. I didn’t find a suitable opportunity to pass this parameter to the material of CesiumGltfPrimitiveComponent. Is there a synchronized event notification external when Cesium generates CesiumGltfPrimitiveComponent, so that newly created CesiumGltfPrimitiveComponents can also apply this texture parameter? Alternatively, provide interface to set parameter before SetMaterial. I cannot call SetMaterial of Cesium3DFileset to modify the material, as this will cause the entire scene to refresh.

---

<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:** [October 10, 2023, 11:05pm UTC](https://community.cesium.com/t/how-to-modify-uvs-during-runtime/27238/4 "2023-10-10T23:05:53Z")

</div>

There’s no event when a new `CesiumGltfPrimitiveComponent` is created. But you can use [GetComponents](https://docs.unrealengine.com/5.1/en-US/API/Runtime/Engine/GameFramework/AActor/GetComponents/2/) on the `Cesium3DTileset` to get all the primitive instances and get or set the material on each.
