# How to use weak\_mapv

**URL:** <https://forums.unrealengine.com/t/how-to-use-weak-mapv/1883443>\
**Category:** Verse\
**Tags:** unreal-editor-for-fortnite, fortnite-creative, question, fortnite\
**Created:** [June 1, 2024, 4:05am UTC](https://forums.unrealengine.com/t/how-to-use-weak-mapv/1883443 "2024-06-01T04:05:30Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Messiah4213](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/messiah4213/32/764721_2.png) [@Messiah4213](https://forums.unrealengine.com/u/Messiah4213)\
**Post date:** [June 1, 2024, 4:05am UTC](https://forums.unrealengine.com/t/how-to-use-weak-mapv/1883443/1 "2024-06-01T04:05:30Z")

</div>

Hello  
Im coding verse for NPC controll and the code I attached is trying to store agent of the spawned NPCs.When I try to call NPCAdded and trying to store to weak\_map, Its failing to store.  
What is wrong about this code?  
Thank you in advance and sorry for poor english

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/2/e/42ea2464e006b8b855a6fdd89fbb87face3b5a4f.png)

---

<div class="post-metadata">

**Author:** ![SpyderNic](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/spydernic/32/933252_2.png) [@SpyderNic](https://forums.unrealengine.com/u/SpyderNic)\
**Post date:** [June 1, 2024, 11:05pm UTC](https://forums.unrealengine.com/t/how-to-use-weak-mapv/1883443/2 "2024-06-01T23:05:43Z")

</div>

I haven’t played with `weak_map` with session as the key yet, but is it possible that `agent` isn’t a supported persistent type?

> **[Using Persistable Data In Verse | Unreal Editor For Fortnite Documentation |...](https://dev.epicgames.com/documentation/en-us/uefn/using-persistable-data-in-verse#persistabletypesinverse)**
>
> Create custom save data that persists across game sessions in Verse.

If that’s the case you could try storing a custom class that contains your array of NPCs instead?
