I’m trying to find a certain actor, then save a reference to that actor so he can be referenced at any time. I found the following function for iterating through actors, but when I try and save ActorItr as an AActor variable, I get a conversion error: No conversion from TActorIterator to Actor exists.
for (TActorIterator<AActor> ActorItr(GetWorld()); ActorItr; ++ActorItr )
{
//myActor = ActorItr; (myActor is an AActor*)
}
Makes sense, but, consistent with what I’ve learned about Unreal so far, I can’t find any further documentation on the subject. Is nobody else having this problem? It seems like a pretty standard function, to save an actor for later use. We do it in Unity all the time with GameObjects, without any problems.
In fact, a quick search for “How to find a game object in Unity” returns exactly what I need, breaking down the functionality and even showing how to assign that object to a variable: Unity - Scripting API: GameObject.Find
Wow, that’s handy!
Unreal on the other hand…: Google
Are people supposed to be born with this knowledge or does Unreal plan on doing any actual documentation in the future? Ranting aside, if anyone has an answer for this, I (and surely other developers considering using Unreal) would appreciate it!