How to spawn an Actor in a SPECIFIC location?

I have 3 blueprint classes.

The first one is the Third Person Character blueprint I got from the engine.

The second is BP_Cube created from the cube static mesh.
The third is BP_Shpere created from the sphere static mesh.

BP_Cube and BP_Sphere both have a variable called defaultSpawnLocation of the type of Transform. The default value of them can be seen in the attached pictures.

266019-image-010.jpg

266020-image-012.jpg

I want to press F key in game and spawn BP_Cube and BP_Sphere according to their variable defaultSpawnLocation.

This is my implementation. It was not complete because I did not know how to access the variable defaultSpawnLocation in the Third Person Character blueprint.

use the GetClassDefault node to obtain the default value of those clases to spawn them

No. It still did not work.

Before connected, the defaultSpawnLocation is usable

But after connected, the variable defaultSpawnLocation is gone.

Loving how dismissive you are.

In any case, you don’t need to connect anything to the Class pin on the GetClassDefaults node. It’s a static class, not a reference to anything. If you connect anything to it you’ll lose its specificity and get the defaults from UObject instead, which is not what you want.

Just as when you SpawnActorFromClass, just pick the class you want and the node will magically transform itself to match that class.

If the value is indeed set as a default, you’ll be able to use it.

SetActorLocation?

(You are really experienced. I did not know how to correctly use the GetClassDefaults node before you told me.)

Maybe I should change another way of implementation to spawn the actor. Because what I want is that the first time I press F, a cube will be spawned at (0, 0, 100) ---- (0, 0, 100) is a location stored in defaultSpawnLocationCube. The second time I press F, a sphere will be spawned at (0, 0, 300) ---- (0, 0, 300) is another location stored in defaultSpawnLocationSphere.

Note that defaultSpawnLocationCube and defaultSpawnLocationSphere are different variables stored in different classes.

So I cannot “Just as when you SpawnActorFromClass, just pick the class” as you said.

Thank you anyway for answering.

yeah, like i said before, don’t be so dismissive, just because you don’t know how to do it, doesn’t mean it can’t be done.

Use a select to pick which transform to use.

The select node allows you to use integers, floats, or enums to pick a value from.

using the bool from a FlipFlop would be a really basic example. But you could use any other number of methods to provide a “state value” to the select node.