# I need help creating actors using strings

**URL:** <https://forums.unrealengine.com/t/i-need-help-creating-actors-using-strings/485731>\
**Category:** Programming & Scripting\
**Tags:** unreal-engine\
**Created:** [July 4, 2021, 1:53am UTC](https://forums.unrealengine.com/t/i-need-help-creating-actors-using-strings/485731 "2021-07-04T01:53:43Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![jonatanventura](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@jonatanventura](https://forums.unrealengine.com/u/jonatanventura)\
**Post date:** [July 4, 2021, 1:53am UTC](https://forums.unrealengine.com/t/i-need-help-creating-actors-using-strings/485731/1 "2021-07-04T01:53:43Z")

</div>

I’m using a plugin to save a .txt file that contain datas of the actors on the map

For example Spawn actor\> save actor class to string array\> save array to .txt file

But now I don’t know how to add this data to a new Strings array when loading this .txt file, and after that I need to turn the string into an actor class, but I don’t know if that’s possible. I would have done everything if the unreal had the option to convert strings into actor classes ( Plugin: [(39) Rama's Extra Blueprint Nodes for You as a Plugin, No C++ Required!](https://forums.unrealengine.com/t/39-ramas-extra-blueprint-nodes-for-you-as-a-plugin-no-c-required/3448))

 ![343174-load.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/0/a/f0a4cdf6520c088c5eceffc6132327b9d0787a46.png)

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [July 4, 2021, 7:46am UTC](https://forums.unrealengine.com/t/i-need-help-creating-actors-using-strings/485731/2 "2021-07-04T07:46:48Z")

</div>

Why not use a save game? It seems a bit of a long way around converting everything like this.

---

<div class="post-metadata">

**Author:** ![jonatanventura](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@jonatanventura](https://forums.unrealengine.com/u/jonatanventura)\
**Post date:** [July 4, 2021, 12:28pm UTC](https://forums.unrealengine.com/t/i-need-help-creating-actors-using-strings/485731/3 "2021-07-04T12:28:28Z")

</div>

I think this way it’s easier for players be able to share their maps. Like, just share the .txt and load it into the game

---

<div class="post-metadata">

**Author:** ![jonatanventura](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@jonatanventura](https://forums.unrealengine.com/u/jonatanventura)\
**Post date:** [July 4, 2021, 12:33pm UTC](https://forums.unrealengine.com/t/i-need-help-creating-actors-using-strings/485731/4 "2021-07-04T12:33:46Z")

</div>

The game contains in game map maker, so I need to save it to a .txt if I want other people to share

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [July 4, 2021, 12:58pm UTC](https://forums.unrealengine.com/t/i-need-help-creating-actors-using-strings/485731/5 "2021-07-04T12:58:35Z")

</div>

So this plugin does writing to text, but not reading from text?

You can’t save the actual actor types, but you can save an integer ( for example ), to represent them. Then, spawning is like

 ![343210-screenshot-2.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/b/6/d/b6d2f7f6d3cf7d5e385f2a53d6fa12456e30be7a.jpeg)

---

<div class="post-metadata">

**Author:** ![jonatanventura](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@jonatanventura](https://forums.unrealengine.com/u/jonatanventura)\
**Post date:** [July 4, 2021, 7:52pm UTC](https://forums.unrealengine.com/t/i-need-help-creating-actors-using-strings/485731/6 "2021-07-04T19:52:06Z")

</div>

Sorry it took so long to reply. I’ll try that and come back here to tell you if it worked

---

<div class="post-metadata">

**Author:** ![BlueMind\_Studio](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@BlueMind\_Studio](https://forums.unrealengine.com/u/BlueMind_Studio)\
**Post date:** [July 5, 2021, 7:25am UTC](https://forums.unrealengine.com/t/i-need-help-creating-actors-using-strings/485731/7 "2021-07-05T07:25:37Z")

</div>

you want to save all the actor classes used in your current level to a (text) file and after that load that file again and spawn the actors from it again? you can totally do that. If this is what you need I can show you an example.  
you should also keep in mind informations from the actors like transform eg. If you plan to use txt file I would serialize that actors to json for example to save additional information from that actor. I’m using a datatable at a project to describe the level with all the actors. you can save/load a DT from/to CSV/JSON and share them easily

---

<div class="post-metadata">

**Author:** ![jonatanventura](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@jonatanventura](https://forums.unrealengine.com/u/jonatanventura)\
**Post date:** [July 5, 2021, 2:44pm UTC](https://forums.unrealengine.com/t/i-need-help-creating-actors-using-strings/485731/8 "2021-07-05T14:44:38Z")

</div>

Hey bro, really thanks for help me! Unfortunately, I won’t be able to post a screenshot of what the entire blueprint looks like, because it’s very, very big. In summary: I added all the items in an array of actors classes, after that I created an int variable, so I can access the items just changing this variable. I save the ids in the .txt file and load it later, like this: Load file \> I get each line in the text (each line = an id) and do it exactly as you showed me in the screenshot above. The hardest part was getting the actors’ transform (which I also saved in the .txt file) In this case I had to split each information, and make a new transform with the information I removed from the file. Now everything works normally.

To spawn the actors, I just loop and remove the last index from each row.

---

<div class="post-metadata">

**Author:** ![jonatanventura](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@jonatanventura](https://forums.unrealengine.com/u/jonatanventura)\
**Post date:** [July 5, 2021, 2:46pm UTC](https://forums.unrealengine.com/t/i-need-help-creating-actors-using-strings/485731/9 "2021-07-05T14:46:54Z")

</div>

I managed to make the load system!! Unfortunately, I won’t be able to post a screenshot of what the entire blueprint looks like, because it’s very, very big. In summary: I added all the items in an array of actors classes, after that I created an int variable, so I can access the items just changing this variable. I save the ids in the .txt file and load it later, like this: Load file \> I get each line in the text (each line = an id) and do it exactly as you showed me in the screenshot above. The hardest part was getting the actors’ transform (which I also saved in the .txt file) In this case I had to split each information, and make a new transform with the information I removed from the file. Now everything works normally.

To spawn the actors, I just loop and remove the last index from each row.
