Download

AActor::Instigator is inaccessible compile error, stuck here

So I’m admittedly doing my FIRST tutorial through this youtube link here:
https://youtube.com/watch?v=1dl91ORwmy8

I do have 9 years of programming background, before flash died I worked at companies making social games with it. So very comfortable with OOP concepts. Php/Mysql,Javascript. I’ve successfully built hello world C++ starter program all the way up to c++ SDL compile that worked on windows/mac/linux. So I’m a c++ beginner, but not a beginner to programming.

that being said I’m stumped on how in that tutorial he writes this line of code that compiles, and it wont for me… here’s the exact time link:
https://www.youtube.com/watch?v=1dl91ORwmy8&t=15m46s

my function (I even commented out the code afterwards to try to solve this compile error)




FHitResult AFPSCharacter::InstantShot()
{
 FVector rayLocation;
 FRotator rayRotation;
 FVector endTrace = FVector::ZeroVector;

 APlayerController* const playerController = GetWorld()->GetFirstPlayerController();
 if (playerController)
 {
  playerController->GetPlayerViewPoint(rayLocation, rayRotation);
  endTrace = rayLocation + (rayRotation.Vector() * weaponRange);
 }

 FCollisionQueryParams traceParams(SCENE_QUERY_STAT(InstantShot), true, Instigator);

 //FHitResult hit(ForceInit);
 //GetWorld()->LineTraceSingleByChannel(hit, rayLocation, endTrace, ECC_Visibility, traceParams);

 return FHitResult();
 //return hit;
}



My error shows up as:



Severity Code Description Project File Line Suppression State
Error (active) E0265 member "AActor::Instigator" (declared at line 643 of "C:\Program Files\Epic Games\UE_4.25\Engine\Source\Runtime\Engine\Classes\GameFramework\Actor.h") is inaccessible BryanLearnV1 C:\Users\dev\Documents\Unreal Projects\BryanLearnV1\Source\BryanLearnV1\FPSCharacter.cpp 54 



my includes on FPSCharacter.h



#include "CoreMinimal.h"
#include "GameFramework/Character.h"
#include "GameFramework/Actor.h"
#include "FPSCharacter.generated.h"



^^ I tried adding “GameFramework/Actor.h” that didn’t change anything. Tried with / without that include

my includes on FPSCharacter.cpp



#include "FPSCharacter.h"
#include "GameFramework/Actor.h"


^^ Tried with / without #include “GameFramework/Actor.h” as well.

How come in that guys video his compiles and I’m stuck here… trying to figure it out.

I’m starting with looking into documentation and starting to learn some of the unreal classes / functions / properties of objects like character,pawn,actor, etc.

Thanks in advance guys!

Try GetInstigator();

Accessing Instigator directly is deprecated, though that wouldn’t usually give this sort of error…

2 Likes

Ah!! Fantastic! I did wonder if it was something being dropped. I was working on mac os, then decided to purchase windows 10 pro and then installed the LATEST Unreal 4.25.0… maybe that version throws and error now. Thanks for the clear up! Now I can keep learning. First community forum experience great. Good sign as I dig into this.

Ah if you’re on 4.25 then yeah that makes sense, Instigator is now a private property I believe.

Thank you @TheJamsh! I was stuck working through Tom Looman’s Tutorial on Udemy setting up the MakeNoise function. Tom was setting the instigator for the projectile and compiling the code fine. He was using Unreal 4.18 though.

I am working through the tutorial in 4.25. By changing MakeNoise(1.0f, Instigator), where I was getting the error “AActor::Instigator is inaccessible” to your solution of MakeNoise(1.0f, GetInstigator()); code compiled and everything is working correctly.

hank you TheJamsh!, saludos de Peru

Hey i have the same problem. I am a newbie and i cant figure out where i am supposed to write GetInstigator(); Please help me.

Hi,

Example:

Instead of this (old)

MakeNoise(1.0f, Instigator);

You have to use this

MakeNoise(1.0f, GetInstigator());

I got stuck on that same problem for six hours last night, and I don’t understand anything from the documentation. Thanks to you a lot, now I can move on.

1 Like