Download

Accessed None trying to read - SaveGame

I’m just trying to do a simple GameSaver but I don’t know how to set the “GlobalVariables_subclass” as default, this one is a blueprint as dummy that only contains variables I will use around the game.
I made a function on the Level Blueprint that is saving the entire object, GlobalVariables. But, obviously, the object is None because I don’t set up the variable to nothing(I was reading about that :D).

Here is the error:

Here how are the GlobalVariables’s variables set up(on the Blueprint i want to reference):

And here’s the function of my problems, the “IsValid?” node shows Is not valid all the time:
1b5a9d0c48b3d9ce41449f719eabff95f1c73ce8.png

And here how is set the object variable to reference to the GlovalBariables blueprint on the function:

Thank you for you attention guys, hope you can help me.

Hey, is “GlobalVariable_subclass” an Object or an Actor?

If it’s an Actor, is it already in the Level?

If yes, you could use “GetAllActorsOfClass” for that specific class to get the Actor and (while checking that the return Array is not empty!) use “Get 0” to get your Actor (based on that Actor being the only of its kind).
[This is not ideal, but can be done.]

If no, you could simply SPAWN the Actor at BeginPlay and then save the return value to your Variable.

If it’s an Object, you need to create the Object.

If you haven’t done this yet, you can simply do “Create Object” and use your Object class.
[Note: I’m not 100% sure if it’s “Create Object”, but it should be something like that.]

Hello eXi, thank you for the response,
“GlobalVariable_subclass” in a reference to the other blueprint, called GlobalVariables as SaveGame type.

I’m trying to create the object and I found the “Select Object” function which return an object reference.
I don’t know if this function is what you say but the return doesn’t matchup with the globalVariables reference.

I just want to fill the “GlobalVariable_subclass”(a reference to GlobalVariables) with the default value, the GlobalVariables BP.

No, I meant a basic Object. You have a SaveGame type there, so you need to use “Create SaveGame Object” to create it or “Load Game From Slot” to load it.
Load Game obviously only works if you create a SaveGame at some earlier point and saved this one. To check if a Game exists you can do “Does Save Game Exist”.

You might want to watch a video tutorial on this, such as:

eXi, thank you another time for your response, it’s very frustating sometimes.

I copied all as the video (is just I was looking for) and works perfect.
Very glad to meet you here.

Cheers.