Download

What's wrong with my blueprint?

Hello friends i tried to follow a tutorial on youtube and even if i did it as exactly was the tutorial i got an error in my script that says “This blueprint (self) is not a Pawn, therefore ’ Target ’ must have a connection.”

I don’t understand where it should target since it’s already targeting to “self”
Here is the blueprint:

So, what i’ve done wrong and how should i fix it?

Thanks!

Change that GetContoller to GetPlayerController.

Thank you!
now i only get a warning that says
‘2DSide Scroller Character’ does not inherit from ‘Player Controller’ ( Cast To 2DSideScrollerCharacter would always fail).

how do i fix that too and btw what’s the difference between GetContoller and GetPlayerController why with the one way it’s wrong but with the other is correct? (learning the inside mechs making it easier to learn something so, explaining is the best)

I might be wrong but I think what you want to do is cast the **Pawn **controlled by the **Player **to a 2DSideScrollerCharacter. If that’s what you want to do, use **GetPlayerPawn **node.

As the warning says, cast only works inside the same inheritance branch. While both **Character **and **Controller **are Actors, **Character **is a **Pawn **which lies side by side with **Controller **in the **Actor **inheritance tree. They are completely different things.

**GetController **is a **Pawn **function, thus it returns the controller associated with the given Pawn. It wasn’t working because you were using it in an Actor, which is parent of Pawn, so it asked you for a **Pawn **reference.

**GetPlayerController **returns the controller for the given Player.