Trying to set camera rotation gets an Error Accessed None, how do I fix this?

I have managed to get a save/load system mostly working, the issue is that when I try to load the camera rotation that is saved, nothing is loaded and it tosses an Error Accessed None

This is the save code which testing has shown to save the camera rotation when the function is called.

And the error code points back to this section of the load blueprint

This has been a headache for me to figure out and I’m not sure if it is the Enhanced Input Mapping system that is to blame or if there is something else. I have tried fixing it in all manner of ways at this point so any help would be greatly appreciated.

Hey!
The error your getting is saying that the return value on GetController is null when you are calling SetControlRotation.

Hard to say why without more info, but you could try calling GetPlayerController instead.

it’ll be loading before possess is taking place, assuming it is possessed.

you can move the SetControlRotation to OnPossess
or do you need to save it at all? you’ve already set the actor transform


This is the player character that I am trying to load the camera for, here is the rest of the blueprint. There is no way to add OnPossess from what I can see and unless I am just missing something here, when I remove that part of the code giving the error, the camera still just defaults to the direction it would be in if you were to load the level without a save existing.

I have tried using the GetPlayerController node instead of the GetController, while it gets rid of the error, the camera is still not getting the saved rotation applied.

You cant add OnPossess to that function, what you can do is save the variable ‘CameraRotation’ and then call SetCameraRotation on OnPossess

Alright, I’ll give it a try

It will not let me add OnPossessed to the Event Graph for the player character blueprint. Should I be using a different actor transform on the third person character blueprint in the load function?

At this point I wonder if just having something setting the camera to be behind the character upon loading would be more feasible than whatever is happening here. The tutorials I have seen show similar set ups to what I have here, some just more built for the video maker’s project, I am using the Enhanced Input System if that helps narrow down what could be the issue here.

Here’s a screenshot of the event graph and the code for the camera input. Thank you for the help so far.

yep that would work too,

I’d usually have my controller spawn its own pawn so you could do all the loading there

An interesting idea, how would I go about having the controller spawn it’s own pawn? For future reference if this attempt to fix things doesn’t work

depends on your game but on controller beginplay, spawn actor of class, possess it and then load it using your data.

use authority if its a networked game and disable the default pawn in the gamemode

That suggestion sounds like I would need to make a separate controller for the character. Is that the right assessment? I’ve currently stored all control logic in the character class I have made which appears to double as the pawn class.

yeah but you just make a child of PlayerController and set it in gamemode defaults. no extra work needed and i cant think of a situation you wouldnt make and use your own PC at some point

As of yet I had not had a need to delve into messing around with the Player Controller class. I will have to look into it some more. Since going about the spawn method I had an interesting bug that spawned four additional player pawns that stood there where the transform data demanded, now that I have created the Player Controller class, they have stopped appearing, though now the transform data is not used but this appears to be a step in the right direction. So thank you for all the help so far.

This ended up helping me out and getting it to work, thank you for the suggestion

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.