I’m surprised that compiles given that Component is not a UObject*. You should need to do something like Component.Get()
Beyond that, my best guess is that the Pawn in question has not been possessed.
As a side note, don’t use GWorld. We’ve spent an immense amount of effort eradicating it from the engine and will, hopefully, eventually bury it in the ground though there is still a ways to go. We are probably going to rename it something like GWorld_DontUseThis to try and discourage new uses of it.
and will, hopefully, eventually bury
it in the ground though there is still
a ways to go. We are probably going to
rename it something like
GWorld_DontUseThis to try and
discourage new uses of it.
Hahaha
have to say Marc, I am enjoying your manner of expression here
Yeah, sorry, it was not a component actually, it was my object derived from UObject, and no, pawn was possessed. Will check and let you know.
Regarding GWorld, i’ve noticed that whenever you need to get UWorld you call actor’s GetWorld inside engine itself. But i thought there’s only one world possible and GWorld is exactly that one.
When you’re in a game there is probably only a single World (you would have to be doing something kind of odd and deliberate to have more than one) and GWorld will point to it reliably. The trouble comes when you are in the Editor. There is the editing world, there can be 1 or more PIE worlds (if you are using the in editor multiplayer testing), and each tool that has a preview window (PhAT, Persona, Blueprint Components panel, among others) also has a World in which the scene is being simulated. For the most part we try to keep GWorld correct by changing what it points to but there are definitely situations in which GWorld is not going to be pointing to the right World.
Your problem is that your Pawn’s input component pointer doesn’t point to a valid input component. There’s a rather simple solution to this, just set your Pawn’s input component to the InputComponent of the Player you want to get input from.
Now your Actor and PlayerController are sharing the SAME InputComponent. You might think they are different InputComponents because you’re accessing it from different objects, but it’s the pointers that are unique, the object they point to is the same, so your Listeners are bound to input from your PlayerController. Anyway, your Binds look a little bit funky too. Say you’re environment is the YourActor class, you’d want something like…