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.
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
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.
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.
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.
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.
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.
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.
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.
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).
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.
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.
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.
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.
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,
Hey there @0xKami! 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.