In my level blueprint I set the camera on BeginPlay to the default camera. When the character advance in the level, I have some box coliision that set another camera using the set view target with Blend. My issue comes when the character respawn… The camera is not the latest one used but the character camera… I have seen many post on this but I don’t know how to solve it.
Don’t save it in the character- If it’s on BeginPlay that means the character has been deleted and re-created, which means any saved variables should be wiped and the character created in its default state. Therefore, any variables will not carry over through the respawn.
You may need to create a variable on the GameMode for whether a camera other than this starting camera is being used, stored as a bool. When you switch to that camera you set the “UsingSeparateCamera” or whatever bool to true. Then, on BeginPlay, check that bool and if it is TRUE, as in you ARE using another camera, do not do branch 1 of your sequence. If it is FALSE, use this new camera.
Let us know if there’s anything further we can help with!
Hello, thanks for your answer! How do I get the reference to my camera then ? They are in the level. Should I use the level blueprint to set the default camera for the character ? And when I reach my checkpoint and switch to the new camera, update the variable ?
I know you talked about a boolean but I have multiple cameras… So I need a reference of the camera at one point I think.
Can the level blueprint call a function that call the target view with blend method ?
The level blueprint CAN call a function with the set target view with blend! You can just do it in the LBP and reference that character and camera. You can set a more permanent reference to the camera by giving the GameInstance a variable for it, and store it there, so it can be accessed by the character from then on. GameInstance doesn’t reset on level or character reload, only on close/reopen of the game.
If it’s in the level, it should be governed by the level blueprint. Just keep in mind things generally only go in and out from the level blueprint, telling other things what to do. So for instance, you can’t have the character reference the level. It’s not a thing, otherwise there would be huge looping issues. Say you change the level, the other things can’t reference the variables from the previous LBP anymore and then “ERROR”.
What you CAN do is have the LBP gather up variables from everything else. If you need something to pass in a variable to the LBP and then react based on that, you can have a function on that actor with various inputs and outputs the LBP can use.