# Identification of components in BP

**URL:** <https://forums.unrealengine.com/t/identification-of-components-in-bp/475217>\
**Category:** Debugging, Optimization, & Profiling\
**Tags:** datatable, tags, unreal-engine, Performance, Array, Components, question\
**Created:** [November 30, 2020, 12:41pm UTC](https://forums.unrealengine.com/t/identification-of-components-in-bp/475217 "2020-11-30T12:41:43Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![BioMedKUL](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@BioMedKUL](https://forums.unrealengine.com/u/BioMedKUL)\
**Post date:** [November 30, 2020, 12:41pm UTC](https://forums.unrealengine.com/t/identification-of-components-in-bp/475217/1 "2020-11-30T12:41:43Z")

</div>

We have a list of states (basically an excel which is imported as a data table) which checks the state of the blueprints in the scene. There are 20 actors(= blueprints instances) which each consist the same set of 6 components (meshes). The user can disable (hide) or enable (show) the 6 components on each of these 20 blueprints instances in the scene. When the user is ready, a button is pressed and the datatable should check which blueprints (instances) have been updated (meaning, the visibility of their components have been changed).  
Each combination (Scenario ID = blueprint ID; component 1 + state; component 2 + state;…) matches with a line in the data table eventually returning a specific Scenario ID.

At the moment the components and their parent blueprint instances are all identified using a tag (in the properties of the blueprint/component). When performing a lookup, we compare the values in the datatable with the tags from the instances and components using the HasTag node and then check the visibility property.

However, we are running into performance issues when the table is consulted. One of the reasons we think is the fact that comparing strings inside the datatable with tags (strings) is pretty slow and we would like to change it into numbers. For example, blueprint instance = 1 which has component A = 1, component\_B = 2.

\*\*

- What suggestions do you have to improve our performance in this setup? Or how would you do this differently?
- What’s your opinion on using tags to identify individual components, what other methods could we use and how (e.g. use integers, one way or another)?\*\*

Thanks in advance for your help or suggestions! It’s much appreciated.

---

<div class="post-metadata">

**Author:** ![BioMedKUL](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@BioMedKUL](https://forums.unrealengine.com/u/BioMedKUL)\
**Post date:** [December 7, 2020, 10:35am UTC](https://forums.unrealengine.com/t/identification-of-components-in-bp/475217/2 "2020-12-07T10:35:29Z")

</div>

Anyone has suggestions or tips?

---

<div class="post-metadata">

**Author:** ![EvilCleric](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@EvilCleric](https://forums.unrealengine.com/u/EvilCleric)\
**Post date:** [December 7, 2020, 12:08pm UTC](https://forums.unrealengine.com/t/identification-of-components-in-bp/475217/3 "2020-12-07T12:08:33Z")

</div>

If all the actors have the same number of components and the state of each component is determine by hide/show, then consider binary, where if row name would be the decimal representation of the hide/visibility of the components:

hide = 0 / show = 1

Table:

 ![324195-1.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/a/f/d/afd1abc5622af901ab82ecb261b7e3d99f2d48db.png)

So, if the visibility of the 6 components of actor X is: 000111 (show: components 4,5,6 | hide: components: 1,2,3), then the corresponding row would be: 7.

---

<div class="post-metadata">

**Author:** ![BioMedKUL](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@BioMedKUL](https://forums.unrealengine.com/u/BioMedKUL)\
**Post date:** [December 7, 2020, 2:23pm UTC](https://forums.unrealengine.com/t/identification-of-components-in-bp/475217/4 "2020-12-07T14:23:41Z")

</div>

Thanks EvilCleric. You suggest to use one variable (type: integer) with 6 numbers of which each number represents the state of a component of that blueprint? Is that right?  
So whenever a user sets a component to visible, I should update this integer by altering the visibility value (e.g. 001000 → 001010).

---

<div class="post-metadata">

**Author:** ![EvilCleric](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@EvilCleric](https://forums.unrealengine.com/u/EvilCleric)\
**Post date:** [December 7, 2020, 3:37pm UTC](https://forums.unrealengine.com/t/identification-of-components-in-bp/475217/5 "2020-12-07T15:37:48Z")

</div>

Here is a possible implementation example (_to simplify and improve efficiency, you can consider the use of bitmasks, id each component with a power of 2 number, and so on_).

You have an actor with 6 static mesh or other type of components, and you want to calculate some value that indicates which components are visible or not:

 ![324212-1.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/a/1/7/a1702c1e013c126019423a4b3ea4ce93e901378e.jpeg)

To calculate the value, we consider a binary number where each digit corresponds to the visibility flag of each component. To calculate its corresponding decimal value, we just use powers of 2:

 ![324213-2.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/b/0/fb0a144b02a2127b62286df7ba6550d5b9bf55f1.jpeg)

So, considering your example: 001000 (which corresponds to the decimal 8) =\> components 1,2,4,5,6 are hidden and component 3 visible.

Setting component 5 visible, it becomes: 001010 which corresponds to 10.

---

<div class="post-metadata">

**Author:** ![BioMedKUL](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@BioMedKUL](https://forums.unrealengine.com/u/BioMedKUL)\
**Post date:** [December 8, 2020, 10:46am UTC](https://forums.unrealengine.com/t/identification-of-components-in-bp/475217/6 "2020-12-08T10:46:49Z")

</div>

Hi EvilCedric, that would be a major improvement indeed. Thanks a lot for your screenshots. That will help tremendously. Feel free to post this as an answer so I can assign your text as answered (and give you a +1).
