Reference in level BP?

How do I reference an actor or blueprint that is not spawned in the world yet? I have objects spawning in, but need to reference variables and components within these objects on the level BP.

Even if they are not spawned yet, there must be a node that spawns them. Just get a reference from that node.

If your wanting to set the variables of actors your spawning in you can set the variables to appear on the spawn node. You can then set them as you spawn them in. The check box is under where you set the variable type.

Ok I see. What about if I want to spawn multiple of the same object? Do I need to make a spawn actor from class for each one on the level BP? What I want is, the player picks a certain number, then that number of objects spawn. Then i need the player to be able to change variables and components for each one separately. Whats the best way to accomplish this?

Any thoughts?

Have you try to set your events in your spawned actor blueprint itself. By using a cursor over as condition to activate or not the event ?

You use a loop and use the number of spawnable actors in the Last Index of the loop and on every index spawn an actor and set each variable in an array.
I’ll show you:

This configuration spawns “AmountToSpawn” pawns on 0,0,0 in your map and gets an array of references you can use later on to access each variable of each pawn when the actor is placed in the world. You can just replace them with whatever class you want to spawn.

So is this in the object BP or level BP? And if I want to spawn objects at different locations, how would that work? Also after its spawn, how do you get each one separately? Get array then get variable of object? Or casting?

This is in a random Actor I just created. If you placed this actor in the level, it would spawn 7 "Default Pawn"s on begin play in 0,0,0 in your map. If you want to spawn objects at different locations, you can just make a custom transform to use the actor’s current location instead and you can place a few of these actors in the level. Or if you want this same Actor to spawn enemies/characters/whatever at random locations, you can always set the Transform’s Location to random with another node.

As for “how do you get each one separately”, as I have shown in the picture, you create an array of the same class as the actor you are spawning and then use ADD to add a new entry to the array. I used Set Array Element because I defined how many I was spawning, so I resized the array to fit that size.

I made an array of 5 transform locations set to random and hooked in to the BP keytotruth made. Whats happening is if I spawn 2 or more, they are spawning ontop on each other and overlapping. The thing is set to not spawn if colliding, but its still doing it.