I am a professional Java developer but I am new with both C++ and Unreal Engine.
My problem is I am trying to write a code to detects all my Cameras in the level and cycles them.
So this is how far I came,
I am not sure with the second cast but it made the error about types go away. But I don’t know if I can cast ACameraActor* to AActor.
Whatever my question is in this state I can not compile my code but all errors shown at Error List are showing library classes which I didn’t wrote of course. Is this error list unhelpful or am I being too lazy to understand? I can’t figure out what the problem is in here.
Open the output panel ( View → output / Ctrl W → Ctrl O )
Error list in nor reliable, output log tell you what compiler say ( much better to fix errors )
in your case, as you said you want to find all cameras : i would suggest to use the actor iterator feature :
for (TActorIterator<ACameraActor> It(GetWorld()); It; ++It)
{
ACameraActor* camera = (*It);
}
Also,you don’t have to cast to correct class when you try to compare 2 Actors ( or UObjects ) because you are comparing pointers, so it would be perfectly find to do
if(OurPlayerController.GetViewTarget() ==cameras[i])
{
// some code
}