How do I call a particular instance of an actor?

I’ve been using actor variables and setting them to “editable” so I can define them in the editor, but this particular blueprint is supposed to be spawned and so I can’t do that. But it needs to call the location of an instance of another actor I placed in the level editor. How do I refer to this particular instance from within a blueprint? The actor variable doesn’t seem to allow for setting a default and the object variable points to a kind of blueprint, not a particular instance.

Hey 0vr,

Have you tried setting an Actor variable to be Exposed on Spawn for your blueprint that needs to take in the reference? When you use the Spawn Actor node and point to that blueprint you need to spawn and recompile, the Actor variable will become available in that Spawn Actor node.

If that’s not what you’re looking for, could you provide a little more detail on what you’re trying to accomplish?

Thanks,

-Steve

I’m not sure I’m following you. I’m trying to get the location of another actor located in the level so I set up an actor-type variable but the variable is undefined and it won’t display the particular asset (or any, actually) in the drop down menu when I go to set the actor-type variable.

Since the blueprint I’m making this in is spawned itself I can’t use the editor to define the actor-type variable, which is what I’ve been doing to work around this issue. What should I do?

Are you spawning Instanced Static Meshes? If so, you can’t reference them individually.

If you are spawning an actual actor or a blueprint actor, then the spawn node should have a return value. Route that return value into an Add Array node for future use.

As long as you are doing this with an actual actor you can reference the actor using the array, or even a simple variable really(Set node), at any time.

What I’m spawning is the actor that has the trigger that’s trying to reference something I placed in the level.

I’ll explain exactly what I’m doing:

when the player is overlapping a trigger box, start a timer which will result in spawning a staircase actor in a random location with another trigger component on the staircase (the staircase is a separate actor from the staircase spawner).The problem is then using the trigger on the staircase to point to the location of an invisible box I manually put into the level, which is its own actor (a destination actor). So how do I call the location of the destination actor from in the staircase actor?

As long as the destination actor isn’t actually an InstancedStaticMesh, then you can store it’s individual reference in an actor variable and then feed that actor variable into your staircase trigger function.

If for whatever reason you don’t have the destination actor’s reference, there are a few ways to get it.

First, is it the only actor of that class in the level? If so, you can use Get All Actors of Class. If it isn’t the only actor of the class you can still do that but I am not sure how the actors get ordered in the array that gets created. That can probably be figured out though.

If overlap events are enabled on destination actor and it has a collision box created for it’s mesh, and you know it’s vector, you can do a Sphere Overlap or a Line Trace.

The individual reference you mentioned is only possible in the level blueprint, right? What I ended up doing was creating another blueprint for the destination so that it is unique and I don’t have to worry about specifying the instance of it. Then I cast to it and called its location (which was a little tricky since the cast to option only appears when you’re dragging off from an object or actor variable node).