# Automatic Actor placement

**URL:** <https://forums.unrealengine.com/t/automatic-actor-placement/664578>\
**Category:** Blueprint\
**Tags:** unreal-engine, Automation, Scripting\
**Created:** [October 7, 2022, 7:48pm UTC](https://forums.unrealengine.com/t/automatic-actor-placement/664578 "2022-10-07T19:48:53Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![playbuxa1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@playbuxa1](https://forums.unrealengine.com/u/playbuxa1)\
**Post date:** [October 7, 2022, 7:48pm UTC](https://forums.unrealengine.com/t/automatic-actor-placement/664578/1 "2022-10-07T19:48:53Z")

</div>

Automatic Actor placement

Hallo, I’m looking for an automatic Actor placement script that would place my meshes into the Viewport/Outliner based on a CSV file.

I’d like to use Editor Utility Blueprint for this. Not a Blueprint actor that you place into viewport and it draws objects after you run game.

I need something that will save me time with the manual actor placement into the scene so I can continue to edit it.

I have used BluePrint Structure to import the CSV file. This is how my example file looks.

 ![test](https://d3kjluh73b9h9o.cloudfront.net/original/4X/b/4/2/b42f420a3eb40bf47594c9823f5183e2b294ef78.png)

Can anyone help me please?

---

<div class="post-metadata">

**Author:** ![SupportiveEntity](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@SupportiveEntity](https://forums.unrealengine.com/u/SupportiveEntity)\
**Post date:** [October 8, 2022, 4:37am UTC](https://forums.unrealengine.com/t/automatic-actor-placement/664578/2 "2022-10-08T04:37:48Z")

</div>

Hey there @playbuxa1! I’d recommend using a direct class reference for the actorBP you’re looking for and transform for your struct instead. I worked up a little sample to do exactly what you described in an editor utility widget.

My struct:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/0/0/900bc367fe31776a7560879e6d74c2861984eb0f.png)

My DataTable:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/e/a/feabfbd9c2fb5e9fa159e2ae713313bb4b0d8fae.png)

My Editor Utility Widget BP:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/2/9/c29ba3099ae754b774b4e080d22aab29e18ba7aa.png)

The result:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/8/8/188b8cd87b23d9afb35db80b08439e1b68012276.jpeg)

* * *

Also the documentation I used:

> **[Scripting the Unreal Editor using Blueprints](https://docs.unrealengine.com/5.0/en-US/scripting-the-unreal-editor-using-blueprints/)**
>
> Describes how to use Blueprints in the editor to automate content production tasks.

* * *

Hope this helps!

---

<div class="post-metadata">

**Author:** ![playbuxa1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@playbuxa1](https://forums.unrealengine.com/u/playbuxa1)\
**Post date:** [October 8, 2022, 1:55pm UTC](https://forums.unrealengine.com/t/automatic-actor-placement/664578/3 "2022-10-08T13:55:36Z")

</div>

Hi SupportiveEntity,

Thank you for your instructions.  
Looks good, I will try it out!

Can you please show me how did you formated the input CSV file used for the inported data table?  
I’m not able to import mine…

Thank you

---

<div class="post-metadata">

**Author:** ![SupportiveEntity](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@SupportiveEntity](https://forums.unrealengine.com/u/SupportiveEntity)\
**Post date:** [October 8, 2022, 8:34pm UTC](https://forums.unrealengine.com/t/automatic-actor-placement/664578/4 "2022-10-08T20:34:54Z")

</div>

No worries! The file pathing is odd sometimes. I’d recommend getting a path to your game’s folder at runtime and appending it so it’s not hardcoded like mine, but here’s how

I’m pulling from a CSV file:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/b/7/9/b79e3ec0424ba6ccfd3b2931d296faeb8c4e4149.png)  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/6/4/d647f8e7e970c450122a85aa7c3bbaf41d775a71.png)

---

<div class="post-metadata">

**Author:** ![playbuxa1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@playbuxa1](https://forums.unrealengine.com/u/playbuxa1)\
**Post date:** [October 9, 2022, 9:54am UTC](https://forums.unrealengine.com/t/automatic-actor-placement/664578/5 "2022-10-09T09:54:28Z")

</div>

Hi,  
I’m sorry I mean the actual CSV file format. How shall I format the data please?  
For example my format of he table was this.

 ![Capture](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/f/0/df06bd6eebc543852bb2dfdfae8f5ddf97807f3c.png)

I’m not sure how shall I format the data in the csv file to get your solution to work.

Thank you very much.

---

<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:** [October 9, 2022, 10:09am UTC](https://forums.unrealengine.com/t/automatic-actor-placement/664578/6 "2022-10-09T10:09:44Z")

</div>

> [@playbuxa1](#):
>
> how shall I format the data

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/8/8/18871894c6afd38e5bf9f359d33bd3226fd42c8a.png)

Create the necessary data struct in the engine, make a data table, add a dummy entry and _export_ the DT to \*.csv. Now you have an _automagically_ formatted sample file you can add extras to.

---

<div class="post-metadata">

**Author:** ![SupportiveEntity](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@SupportiveEntity](https://forums.unrealengine.com/u/SupportiveEntity)\
**Post date:** [October 9, 2022, 1:47pm UTC](https://forums.unrealengine.com/t/automatic-actor-placement/664578/7 "2022-10-09T13:47:01Z")

</div>

Just to illustrate, export a test datatable out to the format you want with at least one test entry, and it will automatically generate a template for you.

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/3/f/f3f09ee8bbb377139cddc635457bb27ae46d49fd.png)

---

<div class="post-metadata">

**Author:** ![playbuxa1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@playbuxa1](https://forums.unrealengine.com/u/playbuxa1)\
**Post date:** [October 9, 2022, 3:02pm UTC](https://forums.unrealengine.com/t/automatic-actor-placement/664578/8 "2022-10-09T15:02:28Z")

</div>

hm… I’m doing something fundamentally wrong.

Can we take it step by step please?

1. I create my structure asset  
 ![2](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/f/2/7f2e0cd1db4f2b6fdefef0c7f1e310714bd66e2a.png)

 ![struckt](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/0/9/209a3baf5e8e0a5379c0593f5f26ee47064755cf.png)  
for ActtorClassReference I set the Actor → Class reference  
for TransformToSpawn I set just Transform

1. I create a dummy csv file in excel with this format, divided by comma not is separate cells  
 ![csv](https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/1/a/61a314d7b91a8002e4fdb91c350f448a82f547f7.png)

2. I import the csv with the “Data Table Row Type” with the created data structure asset that I have created.  

because it is a dummy csv it will give me an error at importing

 ![4](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/8/7/c87b648bb54914ced81b2f6641748876bded60d5.png)

but it will create a Data Table

 ![5](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/a/d/3adcc81da12597668ccaa00af48d5b98e2c8ddc3.png)  
I will have here:  
row name - just as row number,  
ActorClassReference is empty - because of the dummy csv error  
Transform to spawn is being built from the Structure asset and is set with default values.

Is this correct so far please?  
I’m not sure, because I can’t set the ActorClassreference to any mesh asset as you have on your picture.  
You have there in ActorClassReference “BlueprintGeneratedClas’/Game/ThirdPerson/…something”  
I do not see any option as this and can’t navigate to any mesh asset.

 ![6](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/d/8/2d87fa0c6b93f3461137d63f210d613a69dff51e.png)

Thank you

---

<div class="post-metadata">

**Author:** ![SupportiveEntity](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@SupportiveEntity](https://forums.unrealengine.com/u/SupportiveEntity)\
**Post date:** [October 9, 2022, 7:21pm UTC](https://forums.unrealengine.com/t/automatic-actor-placement/664578/9 "2022-10-09T19:21:54Z")

</div>

No worries! I’ll just run through each step piece by piece. So first thing to do is to create your struct. I chose a Class reference and a transform reference since transform houses all you needed.

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/d/9/9d9d88f2ac34564afd25d7b8730b7b14e1f650e0.png)

After this struct is made, I made a Data Table that’s just a placeholder that will give us a clear format. In mine I made 2 entries, but really you only really need at least one. You need to make a new entry, set it’s class reference and you can leave the transforms blank as they will always default to all 0 besides scale.  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/9/3/f935183f6cea3b50642c751a17f09c463d8ab7d4.png)

Then you’ll have at least one entry pointing at whatever class you want, but it needs to be set so you get the layout. It should look like this.

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/8/c/e/8ce5dc30404aa501de83d728f7c3713ac559fb31.png)

After that, save the data table, and go back to the content drawer and right click it, and export as CSV. Once you do, it will become a CSV file you can reference to be able to generate them how you’d like.

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/1/2/2125193c530a2311c4d3146e0c8e05a6ae8db990.jpeg)

The resulting CSV will look a bit like this:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/3/3/63377a852af396bbd1848a74896b63f05c0267c3.png)

That is your template.

Then we make the Editor Utility Widget, same as before. However I had a different DataTable to populate here, I named the other one blank because it was in fact blank (to test the functionality clearly here).

![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/9/7/e97096e363ef73c4bbc8c609697bfaef45089c64.png)

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/e/2/2e24414710f8ba1ce69ba7d64902a0b64f890dee.png)  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/c/e/4cef70bfe0f906dbe0ae7a387ec3c61c2c505a58.png)

and it’s activated via just a little button.

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/6/f/c6fca1e2b2a685b6441adf3b553e2d5bc7cbd4f4.png)

Last thing was opening the Editor Utility Widget, and clicking the button and verifying the test object spawns. I recommend also trying to use the template to add another so you can get the hang of it.

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/b/e/1be1cdbf25deae61b9b39ba0d656e6f4194d0e39.png)

![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/c/e/0ce2c67c1a27abfbb34166b9fb503a404569dfd4.png)

Let me know if you have any questions!

---

<div class="post-metadata">

**Author:** ![playbuxa1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@playbuxa1](https://forums.unrealengine.com/u/playbuxa1)\
**Post date:** [October 12, 2022, 9:45pm UTC](https://forums.unrealengine.com/t/automatic-actor-placement/664578/10 "2022-10-12T21:45:12Z")

</div>

Hi SupportiveEntity,

I’m finally getting somewhere 🙂

I’m able to spawn the BP class third person in my scene.  
I’m also able to edit the exported file, add rows and edit the placement coordinated.  
I can reimport the CSV file without errors.

However, I can’t reference any static mesh object in my library like the SM\_Chair for example.

 ![8](https://d3kjluh73b9h9o.cloudfront.net/original/4X/b/6/a/b6ad4b393c474cbe7c1f1b258b07a065a0aab2c8.png)

I see in your screenshot of the data table, that you have in both lines Blueprint class and you are calling a blueprint object.

If I want to navigate in the Datasheet to any Static Mesch (so I can see the SM class), I do not have such option. Only an default static mesh actor. And this is an empty actor without asigned mesh.

 ![7](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/e/8/fe831d4edb0db7e0987ecf2a13d89b0750e561d3.png)

How can I address actual SM objects in from my library please?

Thank you,  
regards PlayBuxa

---

<div class="post-metadata">

**Author:** ![SupportiveEntity](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@SupportiveEntity](https://forums.unrealengine.com/u/SupportiveEntity)\
**Post date:** [October 13, 2022, 7:21am UTC](https://forums.unrealengine.com/t/automatic-actor-placement/664578/11 "2022-10-13T07:21:33Z")

</div>

No worries, so go back to the struct we made and change it to a static mesh object ref, then reexport the CSV template out before.

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/7/9/c79dac5ca32a29149eae3de90b6da1842c0aac84.png)

After that we make one small modification to the Blueprint. we change the class to a Static Mesh Actor and then take the structs data and send that on over to a Set Static Mesh.

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/6/b/16bec6a083411db0749996f1e9779a994c516ef5.png)

Then voila:  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/e/2/3e24cf4ec80259341082e22b00967e42a4ebf2b0.jpeg)

---

<div class="post-metadata">

**Author:** ![playbuxa1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@playbuxa1](https://forums.unrealengine.com/u/playbuxa1)\
**Post date:** [October 13, 2022, 8:42am UTC](https://forums.unrealengine.com/t/automatic-actor-placement/664578/12 "2022-10-13T08:42:14Z")

</div>

Than you very much SupputiceEntity!!!  
it works great. I’m sooo happy.  
Now it works as I need.

Thank you.

---

<div class="post-metadata">

**Author:** ![Nekwo](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Nekwo](https://forums.unrealengine.com/u/Nekwo)\
**Post date:** [March 24, 2024, 12:48am UTC](https://forums.unrealengine.com/t/automatic-actor-placement/664578/13 "2024-03-24T00:48:32Z")

</div>

Edit: i find that adding code like this within the construction script of blueprints makes more sense and then you can bake it down by converting them into packed level actors. I thought it didn’t work at first but it does, it will automatically bake down the construction script execution into components,

---

<div class="post-metadata">

**Author:** ![SupportiveEntity](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@SupportiveEntity](https://forums.unrealengine.com/u/SupportiveEntity)\
**Post date:** [March 24, 2024, 7:02pm UTC](https://forums.unrealengine.com/t/automatic-actor-placement/664578/14 "2024-03-24T19:02:55Z")

</div>

Hey there @Nekwo! Your use case would be a bit closer to procedural generation than the setup I showed the user above. When working with simple procedural generation, you would want to have reference points on fence pieces to determine where you’d be able to place them. It shouldn’t have an issue in construction scripts, and you can even resimulate them by moving them in editor.
