Getting variables from spawned actor

When I spawn an actor ,
I’ve been trying to figure out how to get my custom variables so I can change them based on variables from the character it’s spawned from.

for instance i have a few bools I want to edit after spawning the “greencharge” actor.

AGreenCharge *SpawnGreen = GetWorld()->SpawnActor<AGreenCharge>(BulletClass, socklock, sockrot);

My variables I created for AGeenCharge are not in the list when I try to find them (SpawnGreen->? )

I swore I did it before,Is there something I’m missing?

If you haven’t included the header file for that class, I would do so. In any case IntelliSense has probably failed to update it’s database and does not recognise the class properly (If you are using Visual Studio).

Ensure that the variables you are trying to access are public and not private.

Yeah I had added my GreenCharge.h include thinking that was it but still didn’t help anything(I already had it in my header file). I could only get the variables spawning in it’s own class .

the variables aren’t under public or private, I’ll add public and see if that fixes it, thanks for the help!


this is what i have in my AGreenCharge .h


	float MoveX;
	float MoveZ;
	float MoveY;

	float  RotPitch;
	float  RotYaw;
	float  RotRoll;

	bool follow;
	bool face;
	bool stayoncourse;
	uint8 turnspeed;
	float facedelay;

	FVector bSavePointLocation;

	FVector PlayerLoc;
	FVector BulletLoc;
	FRotator BulletRoc;

	bool stopfollow;
	bool canface;

this makes them all ■■■■■ right?

I have the GreenCharge.h in my APlane.cpp file (where I’m trying to spawn AGreenCharge).

in my APlane cpp file:

FVector socklock = PlaneComponent->GetSocketLocation("gunsock");
		FRotator sockrot = PlaneComponent->GetSocketRotation("gunsock");
		FActorSpawnParameters SpawnParam;
		SpawnParam.Owner = this;
		SpawnParam.Instigator = Instigator;
		AGreenCharge *SpawnGreen = GetWorld()->SpawnActor<AGreenCharge>(BulletClass, socklock, sockrot);
		GetWorld()->GetTimerManager().SetTimer(TimerHandle_ShotTimerExpired, this, &AZplane::ShotTimerExpired, FireRate);


*This is where I’m trying to get GreenCharge variables that are above. I don’t know why adding the GreenCharge header wouldn’t work :frowning:

I’ve tried to restart visual studio as well