Hi, Im new to UE4 and was following a tutorial from an older version of UE4 and have run into a problem when running the game. I get the error message seen within the MessageLog and have no idea how to fix it and would very much appreciate some help. If any more details are needed I can supply them.
Yea, either you are trying to cast before the vehicle exists or you are casting after the vehicle got destroyed or the vehicle is not a “pawn” or “character”. That would be the reasons for that error.
How do I fix it?
Is there some sort of delay function I can add in to cast after wards, or something were I can check if my vehicle gets casted after it is destroyed or a way to check if my vehicle is a pawn of a character?
You can always use the “is valid” node right before trying to use that pawn reference. Make sure the pawn is valid first. **Still not 100% sure that is the bad node either FYI. Also noticed you have another error with the controller ref in the 2nd image. So that must be an empty reference container and you never “set” the controller.
I would recommend checking out video #1 and video #25 in this series. It explains how to properly cast and the other video shows you a bunch of ways to create references. Both of which seem to be issues here. Fixing it requires making proper references, setting the variables before using them, casting objects that inherit from the class you are trying to cast to etc. The link should help get you looking in the right direction.