Casting in row fails previous ones

Casting in row fails previous ones. My HUDReference is not valid when I cast to another BP. Is this intended? I mean its obviously not a problem. I can just cast to other one when Im donewith first one or make a local varible. Im just curious.

Edit: After reading what I wrote, it think I wrote it a bit wrong. When I said cast fails, I mean that it cancels older casts. So I hooked is valid to HudReference and hookrd it to print string after second cast. it returned as false. But if I place the print string node before second cast, it returns as true. And I tested second cast too, it returns true bc its the last one.

Interesting. And it is getting to the second cast? Have you tried calling something after the cast failed on the first one?

If I understood your question right, I should explain little more. When I said cast fails, I didnt mean that it stopped the executuon on second cast. I was trying to say that it is cancelling older casts. To test it, I hooked is valid to HudReference and hooked it to print string. It said false.

and then if you remove the second cast, printing HudReference doesnt say false? That’s weird. Not sure. Interesting though.

Exactly. If i remove second cast HudReference returns true. I tried it in reverse too. Motion controller as first cast. Same happens. Last cast functions fine but cancels first cast.

Yeah that’s really weird. especially because the 2 casts are completely independent of eachother, not sharing the same variables or anything. I don’t know why that would be intentional. Submit it as a bug and see what they say?

GetPlayerCharacter and GetPlayerPawn access the same value.

If you use a player pawn that inherits from Character, GetPlayerCharacter will return a Character reference.

If you use a player pawn that inherits from Pawn and not Character, GetPlayerCharacter will return “None”.

GetPlayerPawn will always return a Pawn reference.

So you might as well use “GetPlayerPawn” twice for your casts.

However. The player pawn then needs to inherit from or be both the classes you cast to. Meaning if you want both anyway, you might as well only cast to the lowest child which will provide you with all functionality the parent would’ve provided and the additional functionality it implements itself.

I didnt know that I could use pawn for both.

I tried to reproduce this today but I cant reproduce it. Motioncontroller cast always fails (ı mean cast itself fails). Maybe I was doing something wrong in the first time.