Accessed None trying to read property [UE4]

I know this isn’t a new topic, but I can’t seem to work out how to resolve this through other forum posts. Basically, I’ve got a blueprint referencing another blueprint, but whenever I run the game I get the Accessed None error.

Here’s the setup of the reference:

I’m not exactly skilled in UE4, or game design as a whole. But I’ve been following tutorials and sort of Frankenstein-ed a solo build from the little I do know. Focusing on making a simple Flappy Bird/Helicopter/Galaga like game, where you’ve just got to pass as many obstacles as you can without crashing.

Engine Version: 4.26.2

1 Like

Im about as unexperienced as you, but I believe the problem is in the event being “on component begin overlap” and not “actor begin overlap”.

Edit: this in probably not the solution. Look below.

The problem may also be that you’re destroying the actor that’s running the code, and then calling IncrementWallsPassed…

2 Likes

Shoot, that didn’t solve it. Thanks for taking the time to respond though :slight_smile: I also tried removing the DestroyActor node, but again didn’t seem to matter…

1 Like

That didn’t seem to make a difference. Thanks for the response though :slight_smile:

2 Likes

ok, then the game manager variable is not assigned…

1 Like

Consider posting the actual error message, makes it easier to troubleshoot. The thrown error tells you what’s up and has a link to the piece of the script where things went downhill.

Excuse my lack of understanding, but what does that mean? Like, how do I assign that? :confused:

I assume you mean the error log?

There it is. I get that it means the issue is in the BP Checkpoint Blueprint, in my Increment Walls Passed function. But don’t know why it’s actually triggering.

As @ClockworkOcean said. The reference variable to BP Game Manager is not valid. This blueprint does not know which object you mean, we only know the object type.

How does the BP Game Manager make into the game? Is it placed in the level? We spawn it from class?

Imagine there are 3 managers like this - how does this blueprint know which of the 3 you mean?

Creating a variable (BP Game Manager) that can store a reference to an actor is of little use if we do not tell it which object it’s supposed to point at.

1 Like

After killing the actor, “get gamemode”, cast to it, and do the function there. You probably also need/should move all other functionality to that gamemode.

OR

In project settings, set default gamemode to “BP Game Manager” if possible.

Sorry for taking so long, haven’t had a chance to check this post 'til now. I’m not sure I quite understand what you mean by the variable not being valid, is there an extra step to validating aside from creating the new variable as an Object Reference from the Blueprint?

It links to the Increment Walls Passed function in my Game Manager blueprint, which in turn connects to my Widget to display a counter showing the amount of walls successfully passed. But is there another node I need to add somewhere?

Since the Increment Walls Passed node isn’t connected to any event chains, is that messing up? The tutorial I’m basing it on had no connections to the Game Manager’s events, so I didn’t add it either.

So move it all into a Game Mode blueprint? I have one set to point to my Character blueprint being the default pawn, should I try moving the Increment Walls Passed node into there? If so, how do I go about that, just by creating a new Variable with an object reference to the Game Mode bp?

1 Like

Oh yes. Imagine you create a string variable but forget to type the text. Not that useful, is it?

That object reference is sort of like that, but worse.

How does that object end up in the game? You must create it somehow. An object is stored in computer memory, the variable indicates where to look for it.

I’m guessing that’s separate to the Variable Type - the one in the details panel when the variable is selected - so how can I create the object? Do I need to have some form of spawn system in for the Game Manager blueprint, or maybe set the variable as itself?

Yes. You spawn an actor from class and assign it to a variable. Or drag the blueprint to the level blueprint to reference it there. And another way to instantiate is to use a Child Actor


Perhaps you could briefly describe the role of this manager, this way we can try to give you a more tangible suggestion.

Perhaps this manager can be created and referenced by one of the framework classes (pawn / game mode / controller). These are easilly accessible with global getters by any blueprint.

Should the “Increment Walls Passed” not be before the “Destroy Actor?”

Thanks for taking the time to help me, and I apologize for taking so long to get the problem :confused:.

As an actual Actor, the Game Manager holds the camera used during gameplay, so it doesn’t use a view from the Pawn class, as well as a spawn area and destroy area for the walls that act as obstacles.
It’s also where the game has it’s functions to check if the player character has crashed, how frequently the walls should spawn, and to display the UI Widget. It basically does everything but control the player and make the walls move, which are in two separate Blueprints.

I’ve tried setting the actor from class, but still getting the error as well as it snapping the camera back to the pawn. I also tried using the Child Actor, but still got the issue? I may have done it incorrectly, though.

Again sorry for this taking so long…

I tried changing it, and it remains that way now, but it doesn’t seem to have changed anything.

It helps pulling out the Print String node out of everything that can be causing this and type in different messages. If no message comes after something, you know nothing is happening exactly there.