By the end of this journey, you'll be able to create a new actor from scratch and spawn it anywhere in the world.
For reference, you can download archives of my project files from before this journey began and after its completion.
In our last excursion, we figured out how to find the player's position in the space rig. Let's put that information to good use and add something new to the abyss bar.
First, we'll need something to add. Let's create a simple cube actor from scratch:
AdventurousMod
folder and create a new blueprint. Since we want to add it to the world, choose Actor
as the parent. Name your new blueprint BP_AdventureCube
(or, you know, whatever you want).
Add Component
.Cube
under Common
.
Cube
for this new component. Unsurprisingly, you'll see a cube in the viewport for your new actor:
Okay, that was crazy-easy. We're bound to run into some more difficulty as we go on.
Before we can spawn anything in our world, we'll need to know where to spawn it. We could just spawn it at the origin, 0,0,0, but where's that?
Luckily, thanks to our last adventure, we have an easy way of getting world coordinates. We can just launch our mod, run around to roughly where we want to spawn something, and take note of the player position.
Do that now and pick a place in the Abyss Bar to spawn our cube. I'm going to use this empty area to the left of the bar:
I bet from here you can figure it out all on your own. But here's the steps we'll follow to spawn the cube in this location:
BP_AdventurousMod
in the blueprint editor and go to the Event Graph
.Spawn Actor from Class
node and set BP_AdventureCube
as the class.Spawn Transform
struct and for Spawn Transform Location
, fill in the coordinates you determined earlier.Collision Handling Override
to always spwan, and your blueprint should now look like this:
Holy crap, it worked!
Buy yourself a strong beer management-approved beverage to celebrate.
Now you know how to create totally-custom actors and spawn them into the world. Admittedly, finding coordinates manually like this isn't really practical for gameplay mods, so a later journey will explore spawning in a more dynamic way.