# Getting per instance HISM data

**URL:** <https://forums.unrealengine.com/t/getting-per-instance-hism-data/1375600>\
**Category:** Programming & Scripting\
**Tags:** unreal-engine, question\
**Created:** [November 9, 2023, 10:58am UTC](https://forums.unrealengine.com/t/getting-per-instance-hism-data/1375600 "2023-11-09T10:58:10Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dale\_Wastell](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/dale_wastell/32/88717_2.png) [@Dale\_Wastell](https://forums.unrealengine.com/u/Dale_Wastell)\
**Post date:** [November 9, 2023, 10:58am UTC](https://forums.unrealengine.com/t/getting-per-instance-hism-data/1375600/1 "2023-11-09T10:58:10Z")

</div>

Hello awesome comunity. How do I save additional per instance data for a hierarchical instanced static mesh?

I have a game that simulates an ecosystem and am running into a problem with the hierarchical instanced static mesh. For preformance reasons, I am using multiple HISM objects to track plants (which spawn and get eaten etc). I need to store additional data for each mesh. Using objects in a lookup dictionary results in indexing problems - no matter what I try I can’t keep the indices matched. So I am looking at storing data in the material. I can easily add custom data into a material via the ‘set custom data value’ command but how do I retrieve these values?

As example, a plant instance needs to keep track of its spawn time for life span and size, the amount of nutrition it provides, its seeding cycle etc. so I need a fair amount of additional data for each mesh. I also need to be able to periodically loop through the HISM to update the size of the plants as they grow. I have all the logic in place and working but can’t get around the indexing problems as plants get eaten.

Please help  
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:** [November 9, 2023, 2:05pm UTC](https://forums.unrealengine.com/t/getting-per-instance-hism-data/1375600/2 "2023-11-09T14:05:42Z")

</div>

In BPs that’d be a no-no. In C++ perhaps? Google confirms this exists:

```auto
GetCustomDataValueOnInstance

```

But I’ve never seen it done or even documented…

* * *

Besides the above:

> so I need a fair amount of additional data for each mesh

The official docs state one can store 32 floats, which is not true - at least it wasn’t in 4.27. The actual number is either 16 or 18 - last time I tested it. Which is still plenty but it’s just floats.

> [@Dale\_Wastell](#):
>
> can’t get around the indexing problems as plants get eaten

How I do it:

- use the Tmap with key being the index and enjoy any data type via a struct
- never **remove** instances
- instead, **move** them where they can’t bother you; flag its `hasBeenEaten` map data appropriately
- bunny eats a carrot? That carrot now lives 5000 uus underground where no sensible bunny should go
- to regrow it, reuse one of the eaten carrot instances that lives underground
- at some point you’ll need to save it all - that’d be the time to trim the HISMc and repopulate the map from scratch

Think of this as of object pooling. The key is to not remove any HISM instances.

* * *

Example:

> [@How to add a hit count (health points) to individual instances?](https://forums.unrealengine.com/t/how-to-add-a-hit-count-health-points-to-individual-instances/227176/2):
>
> The name of the game is Custom Primitive Data (check docs at the bottom). The material for a brick: each instance stores a float which is used to Lerp between 2 colours (to visualise hits remaining) this can (and probably should) get prettified Making a brick wall: create a bunch of instances and store their data in an int | int Map instead of an integer, you could have a struct and hold all kind of data here; perhaps this brick is worth some coins, or explodes when destroyed and …

---

<div class="post-metadata">

**Author:** ![Dale\_Wastell](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/dale_wastell/32/88717_2.png) [@Dale\_Wastell](https://forums.unrealengine.com/u/Dale_Wastell)\
**Post date:** [November 9, 2023, 2:52pm UTC](https://forums.unrealengine.com/t/getting-per-instance-hism-data/1375600/3 "2023-11-09T14:52:15Z")

</div>

Thanks for the reply, it appears that aside from the ‘plant purgetory’ with reincarnation which I don’t really like there is no viable solution. I have the same problem with seeds which disappear and spawn plants. If I need relocate everything and store a reincarnation array (souls awaiting liberation from hell and rebirth into the material world) to recycle things, Hell is going to be pretty crowded. Still, thanks for the reply - I guess I’ll start coding demigod Hades / Yamaraj…

I’ve done pretty extensive research and can’t seem to find any more elegant solution. If anyone knows of one, please share…

---

<div class="post-metadata">

**Author:** ![gatosilencio](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@gatosilencio](https://forums.unrealengine.com/u/gatosilencio)\
**Post date:** [October 18, 2026, 1:40pm UTC](https://forums.unrealengine.com/t/getting-per-instance-hism-data/1375600/4 "2026-10-18T13:40:08Z")

</div>

Have you found a more elegant solution or did it work out with reincarnation for plants? Very curious
