Hey everyone, my UE4 is crashing on the TickActor function, and this occurs every time I press play.
It crashes on line 67 of my code:
Any help would be appreciated! Thanks!
Hey everyone, my UE4 is crashing on the TickActor function, and this occurs every time I press play.
It crashes on line 67 of my code:
Any help would be appreciated! Thanks!
Hello, the problem is that either the player controller is not of type AMainPlayerController or MainPlayerController->PortalManager is null.
Hope this helps!
Make sure MainPlayerController is an actual object first. Right now you’re casting and you arent checking if it properly casts or not so wrap line 67 with an if(MainPlayerController) (this is a null check) and it should run fine. If your code doesnt work as intended it means that something isnt grabbing the main player controller for whatever reason.
Maybe it the player controller doesnt exist for the first frame or maybe theres a different problem but thatll definently solve your crashing.
Might not want to put that in Tick though FYI. Maybe get a reference to the controller in begin play, store it as a reference so all you have to do is call the code ran in PortalManager in tick opposed to casting the controller over and over again
Thank you that solved the error!
Oh, never mind, I see this has been answered. (My posts are delayed)