Hi,
I hate to ask such a personal question, but why does GetTransfrom.SetLocation() do nothing when called directly? I am using the following code to move my actor every frame:
void AMyTower::Tick(float DeltaTime) // same as Update in Unity
{
FTransform tr = GetTransform();
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Blue, FString::SanitizeFloat(Speed*DeltaTime));
GetTransform().SetLocation(tr.GetLocation() + FVector(Speed*DeltaTime, 0, 0));
Super::Tick(DeltaTime);
}
The Debug Message tells me that Tick is excecuted and that Speed*DeltaTime != null. Yet nothing changes in gameMode. When I print just the transform location while moving the actor manually it does change, so that means that I have the right transform right?
Any help would be appreciated. I just started using UE4 and already I’m stumped :S
Thanks!
Please don’t bump a 3 year old thread, just start a new one.
The “red underline” is Intellisense throwing an error. These aren’t real compile errors, just parsing failures. You can safely ignore them 99% of the time (or install Visual Assist which replaces Intellisense and works much better).
If you are getting actual compile errors from that line, then you are likely missing an include for the actor/component. Just find where the actor/component is declared and add that file as a include.