Announcement

Collapse
No announcement yet.

Cast on event begin play fails

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • replied
    Have you used the blueprint debugger? Play the game, open the blueprint, and see where the cast event fails. There's also a node where you can specify an event when a cast fails to call another action/event/node.

    Leave a comment:


  • replied
    1. where is this graph in?
    2. BeginPlay was invoked at different time for different actors(ie world, gamemode, pawn, playercontroller, hud, etc...)
    3. always check if it's valid for things when you call getXXX, there is like double if not triple checking wall in the engine just to make sure things happen in a proper manner( you can imagine that with server/client model, many things could happen not in the order you like to believe.)

    I'm currently just scratch the surface of how the engine side in code works, so don't be too surprised that BeginPlay didn't help you to get everything when other stuff is initializing, as it only fire once.
    What you should do is to use events and function/interface to help you push/pull spawned actor info to/from the actor needed.

    Leave a comment:


  • replied
    Checking Get Hud -> isValid is producing a Not Valid result.

    When does get hud get invoked?

    Leave a comment:


  • replied
    I'm not sure how to check which error it is, but more than likely it IS null.
    Any casting to hud through an event fails. The same cast succeeds from a key press.
    I am baffled...

    Leave a comment:


  • replied
    What kind off error do you get? A null reference ?

    Leave a comment:


  • started a topic Cast on event begin play fails

    Cast on event begin play fails

    Is there any reason as to why an attempted cast when the game begins would fail, but succeed when a button is pressed?
    Even following a delay time after begin play, the cast fails.

    Any suggestions?


    Begin Play -> Delay [5] -> [Get Player Controller[0] -> Get Hud -> Cast to MyHUD] ==> Fail
    X key press -> [Get Player Controller[0] -> Get Hud -> Cast to MyHUD] ==> Success
Working...
X