# How to create a matrix of floating text?

**URL:** <https://forums.unrealengine.com/t/how-to-create-a-matrix-of-floating-text/480768>\
**Category:** AI\
**Tags:** matrix, textbox, unreal-engine, grid, question\
**Created:** [March 23, 2021, 5:30pm UTC](https://forums.unrealengine.com/t/how-to-create-a-matrix-of-floating-text/480768 "2021-03-23T17:30:35Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Galedon95](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Galedon95](https://forums.unrealengine.com/u/Galedon95)\
**Post date:** [March 23, 2021, 5:30pm UTC](https://forums.unrealengine.com/t/how-to-create-a-matrix-of-floating-text/480768/1 "2021-03-23T17:30:35Z")

</div>

Hello,  
I have a square grid on the map and I need to make a (unique) floating value above each square.  
I build my texts matrix in construction script using AddTextRenderComponent - that works fine.

 ![333356-createtexts.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/d/8/2d8c2dac075b250452d7f82c14d0eeaa0e6df1b0.png)

The problem is that I am not able to change the text to a number of my choice. I tried the following code, but I got access none to SetText.

 ![333357-tempchange.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/8/3/0/8306ba1e57d1e695446bfe7cf81dd690260054b8.png)

Any idea how to make this work?  
Thanks

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [March 23, 2021, 5:41pm UTC](https://forums.unrealengine.com/t/how-to-create-a-matrix-of-floating-text/480768/2 "2021-03-23T17:41:50Z")

</div>

![333358-screenshot-1.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/3/1/731d25021045333286b76d57dab95eddcd441bc6.jpeg)

This bit looks dodgy. You already have an array full of text render components. Seems like all you need is to set their text.

---

<div class="post-metadata">

**Author:** ![Galedon95](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Galedon95](https://forums.unrealengine.com/u/Galedon95)\
**Post date:** [March 23, 2021, 5:46pm UTC](https://forums.unrealengine.com/t/how-to-create-a-matrix-of-floating-text/480768/3 "2021-03-23T17:46:26Z")

</div>

Thank you for the answer.  
I tried this at first but I got an refference error:

 ![333359-errorref.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/f/c/7fc0f20427fe04ef85435ced73256889172fa4d7.png)

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [March 23, 2021, 5:47pm UTC](https://forums.unrealengine.com/t/how-to-create-a-matrix-of-floating-text/480768/4 "2021-03-23T17:47:08Z")

</div>

Note the green arrow in my pic.

---

<div class="post-metadata">

**Author:** ![Galedon95](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Galedon95](https://forums.unrealengine.com/u/Galedon95)\
**Post date:** [March 23, 2021, 5:57pm UTC](https://forums.unrealengine.com/t/how-to-create-a-matrix-of-floating-text/480768/5 "2021-03-23T17:57:00Z")

</div>

Aaa, sorry I misunderstood you - I tried it with the connected pin now, but the error is still there:

 ![333365-errorref1.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/9/6/3969796261096e8b0a97e7f948b194646f95992a.png)

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [March 23, 2021, 6:05pm UTC](https://forums.unrealengine.com/t/how-to-create-a-matrix-of-floating-text/480768/6 "2021-03-23T18:05:48Z")

</div>

We can’t see the end of the error message here. But my guess is that you do not have enough elements in the Temperature array.

* * *

Print the length of `TempText` and the length of `Temperature` arrays and see what they read. They should be equal.

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [March 23, 2021, 6:08pm UTC](https://forums.unrealengine.com/t/how-to-create-a-matrix-of-floating-text/480768/7 "2021-03-23T18:08:30Z")

</div>

Double check the math on adding the elements to Temperature - very likely to be the culprit.

 ![333360-screenshot-1.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/3/3/633c1d0ff9fe8d35e146dd10cc5662438f542786.jpeg)

How many elements are then when the loop Completes?

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [March 23, 2021, 6:09pm UTC](https://forums.unrealengine.com/t/how-to-create-a-matrix-of-floating-text/480768/8 "2021-03-23T18:09:59Z")

</div>

When you click the error message, it will take you to the offending bit of script. Hard to tell what’s going on as we can’t see it all.

---

<div class="post-metadata">

**Author:** ![Galedon95](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Galedon95](https://forums.unrealengine.com/u/Galedon95)\
**Post date:** [March 23, 2021, 7:12pm UTC](https://forums.unrealengine.com/t/how-to-create-a-matrix-of-floating-text/480768/9 "2021-03-23T19:12:15Z")

</div>

Thank a lot for all the answers - It was in deed in the array lengths - one was zero and second 189… 😃 I will now have to figure out why…

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [March 23, 2021, 10:34pm UTC](https://forums.unrealengine.com/t/how-to-create-a-matrix-of-floating-text/480768/10 "2021-03-23T22:34:21Z")

</div>

Btw, next time you need to deal with a 2 or 3 dimensional array / matrix - have a look at this node:

[https://forums.unrealengine.com/development-discussion/blueprint-visual-scripting/1871739-blueprint-array-spawner-math-help?p=1871755#post1871755](https://forums.unrealengine.com/development-discussion/blueprint-visual-scripting/1871739-blueprint-array-spawner-math-help?p=1871755#post1871755)

Another example:

[https://forums.unrealengine.com/development-discussion/blueprint-visual-scripting/113585-how-do-i-get-mouse-clicked-position-on-chessboard-mesh?p=958069#post958069](https://forums.unrealengine.com/development-discussion/blueprint-visual-scripting/113585-how-do-i-get-mouse-clicked-position-on-chessboard-mesh?p=958069#post958069)

It can simplify logic and returns useful data.
