My camera BP doesn't respawn anymore

Hello,
I am creating a 2,5D platformer, as i am a begginner with unreal, it is the combination of many differents tutorials put together.
I am not sur when the respwan of the camera properties stopped working.
Now after death my character respawn and can be control, but without the camera manager.
I also now have an error related to my BP_Camera :
Blueprint Runtime Error: “Attempted to access BP_Hero_C_0 via property FollowTarget, but BP_Hero_C_0 is not valid (pending kill or garbage)”. Node: Set Actor Location Graph: Update Camera Pos Function: Update Camera Pos Blueprint: BP_CameraManager

It seems that my destroy actor is causing the problem (?)
Sorry for the large amount of screenshots.
Thank you




I’m assuming things stopped working when you incorporated spawning?

I see the player spawning a new player and destorying itself, but there’s no mention of the camera manager. So it’s still trying to follow the old player, who is in the garbage heap :slight_smile:

Code the camera manager with an ‘isvalid’ on the player reference. If the player is valid, follow them, if not, use ‘get actor of class’ to find them again, and re-assign the variable. Then, follow them.

Thank you very much for your answer and sorry by advance for my noobizme.
Should i use an Isvalid? or Isvalid(f)
In both case i don’t know where to plug the exec for the ? and the boolean of the f

Right at the beginning of your follow function.

It doesn’t matter which isvalid you use.

Just check if the reference is valid. If it is run the function, otherwise don’t

:slight_smile:

I’m trying to follow your advice but I’m not sure I’m doing it right. I no longer have an error report but the respawn isstill happening without the camera properties

Yes, that’s right. I’m gonna have to come back in a while. Bit busy… :-/

I see the player spawns a new camera manager on being play also.

So maybe what you need to do is get rid of the camera manager when you get rid of player.

I can’t really see what’s going on here TBH :slight_smile:

Also, most of the time you get the game mode and cast it ( fine ), in one spot, you use a BPI to talk to it ( fine again ), but here, you seem to have a reference to it

which is it? Is this reference assigned to anything?