# How can i get a blueprint instance's component in cpp?

**URL:** <https://forums.unrealengine.com/t/how-can-i-get-a-blueprint-instances-component-in-cpp/381414>\
**Category:** Blueprint\
**Tags:** get-all-actors-from-, unreal-engine, question\
**Created:** [January 10, 2017, 5:05am UTC](https://forums.unrealengine.com/t/how-can-i-get-a-blueprint-instances-component-in-cpp/381414 "2017-01-10T05:05:21Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![iwingn](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@iwingn](https://forums.unrealengine.com/u/iwingn)\
**Post date:** [January 10, 2017, 5:05am UTC](https://forums.unrealengine.com/t/how-can-i-get-a-blueprint-instances-component-in-cpp/381414/1 "2017-01-10T05:05:21Z")

</div>

I create a blueprint and add a spline component in it.Then I place and edit it in edit ,wish it can be used as a route for some kind of creature.  
The question is how to get the actor placed in the level,and how to get its component.  
I have try GetComponentsByTag and GetComponentsByClass. But it just return null.

---

<div class="post-metadata">

**Author:** ![Speckulous](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Speckulous](https://forums.unrealengine.com/u/Speckulous)\
**Post date:** [January 10, 2017, 8:14am UTC](https://forums.unrealengine.com/t/how-can-i-get-a-blueprint-instances-component-in-cpp/381414/2 "2017-01-10T08:14:19Z")

</div>

**C++**

From the [docs](https://wiki.unrealengine.com/Iterators:_Object_%26_Actor_Iterators,_Optional_Class_Scope_For_Faster_Search#Actor_Iterator)

```
for (TActorIterator<YourSplineActor> ActorItr(GetWorld()); ActorItr; ++ActorItr)
{
	// Access the subclass instance with the * or -> operators.
	YourSplineActor *Mesh = *ActorItr;
}

```

There you get ALL actors of the current Level from the type “YourSplineActor”, you can just assign it to a local varible now and access all spline points etc, if you got more than one, you can save them as array and access them through a id you specify in the BP

**BPs:**

Same procedure  
“Get All Actors Of Class” returns an array of your chosen class

---

<div class="post-metadata">

**Author:** ![iwingn](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@iwingn](https://forums.unrealengine.com/u/iwingn)\
**Post date:** [January 10, 2017, 2:32pm UTC](https://forums.unrealengine.com/t/how-can-i-get-a-blueprint-instances-component-in-cpp/381414/3 "2017-01-10T14:32:35Z")

</div>

MySplineActor is a Blueprint Actor inherit from Actor,and add a Spline component. I want to call GetLocationAtDistanceAlongSpline or other Spline’s Functions.If I assign it in Mesh,and how could I get its Spline component??
