UE_LOG error

Ello, I keep getting an error that I can’t get rid of until I comment out the code under “/// See what we hit”, which starts at line 77 of Grabber.cpp for me.

expression preceding parentheses of apparent call must have (pointer-to-) function type

I’m guessing this is one of those tricky things about macros Ben was talking about, because I have no other idea at the moment.

/// See what we hit
	AActor* ActorHit = Hit.GetActor();
	if (ActorHit)
	{
		UE_LOG(LogTemp, Warning, TEXT("Line trace hit: %s"), *(ActorHit()->GetName()))
	}

Not really, it’s because you’re adding () to ActorHit, it’s a variable not a function call.

1 Like

OK,
somebody was copying what he (thought) he was seeing and wasn’t really following along…

That’s strange, I wasn’t getting anything in the output log but when I appended AddOnScreenDebugMessage() to the if-statement, I got output on the screen:

AActor* ActorHit = Hit.GetActor();
	if (ActorHit)
	{
		UE_LOG(LogTemp, Warning, TEXT("Line trace hit: %s"), *(ActorHit->GetName()))
		GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, FString::Printf(
			TEXT("Line trace hit: %s"), *(ActorHit->GetName())));
	}
1 Like

Do you have a filter set on your output?

I got the same “error” with the log not appearing then i literally copied that piece of code of Laserbeak43 and the log appeared with the debug messages in red on the viewport, then I delete that piece of code but the log message kept showing, but thanks for the help
*Actually I think there is a specific spot that we need to touch to show the message log

I’ve not touched the out verbosity and was able to test an error catcher made later in the course. So, I don’t think that was an issue for me.

To show the messages in the log I changed the objects (chair and table) Collision Presets to PhysicsActor.

Using 4.18.1, I encountered the same problem. The LogTemp warning for the line trace hit did not display in the output log (I verified it was showing warnings, the grabber reporting for duty was displayed in the log) until I pasted the same code Laserbeak43 provided and you mentioned. Rebuilt the project and received multi messages for Line Trace hits. Then I deleted that same code (AddOnScreenDebugMessage…) and rebuilt the project. I am still receiving the line trace hit warnings.

The objects collision presets were already set to PhysicsActor (toggled it to test, no change), and Simulate Physics was set with a MassInKg value of 10.0.

For Unreal 4.20 @Laserbeak43’s solution doesn’t work for me anymore. Nothing gets logged which is called from inside of UGrabber::TickComponent after adding the methods for LineTracing. Did anyone get log outputs in Unreal 4.20 ? Please share :slight_smile:

Turns out after restarting Unreal all logs started appearing for me - without using Laserbeak’s solution.

Privacy & Terms