Best way to add mesh on the map with a command

Hi, i am looking for a way to add a static mesh on the map with a command by stating its name its location and rotation like

example:
add mesh_name 200,10,0 0,0,0 would add the mesh at the location with the rotation.

Would anyone know if thats a thing and how to do something like this?

Edit: when you copy a mesh in game you can edit the string it copys with custom values and then paste it back it.

https://docs.unrealengine.com/en-US/PythonAPI/class/EditorLevelLibrary.html?highlight=spawn#unreal.EditorLevelLibrary.spawn_actor_from_object

for asset in unreal.EditorUtilityLibrary.get_selected_assets():
    unreal.EditorLevelLibrary.spawn_actor_from_object(asset,unreal.Vector())

Above Python code would spawn the selected asset into current world.

2 Likes

Got info from here: Call Blueprint Event from Console - #5 by Irascible

In your Level Blueprint:


In the in-game console, type ce AddStaticMesh [path] [x] [y] [x] [roll] [pitch] [yaw].

Example:
ce AddStaticMesh /Game/StarterContent/Props/SM_TableRound 0 370 325 0 0 0
add static mesh


If you don’t want to do it this way, you can try this tutorial: Unreal Engine - Create console commands in blueprints // Sahil Dhanju's Blog. It requires c++, but allows you to create console commands from blueprints.

Hi, thanks for your reply but i was asking about adding static mesh to the world it self (outside the game)

So do you mean add it in-game and have it save and be there the next time you open the level? Or do you mean through a text file outside the game?

This topic is solved anyway i found the solution I needed.

1 Like