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.
C++
From the docs
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
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??