Branch Node Accessed None

Hey everyone,

I was just making a 3D version of Pac Man in the Unreal Engine when I came across an “accessed none” error after I made it so that you can eat ghosts for points. Im following a tutorial here: https://www.udemy.com/course/unreal-engine-4-create-an-arcade-classic/learn/lecture/9517276#questions

In the screenshots, it appears that the branch node is the problem. However, I don’t know how to fix the null variable with an IsValid node. After all, I just started learning Unreal. Can anyone provide a solution? Thanks!


You need to show the code that’s causing the problem.

But I can tell you that it will be an unassigned variable. It’s no good having a variable of the right type, it has to actually point to something.

2 Likes

Sorry bout that, seems one of the screenshots didn’t register or something. Anyways, here is the code including the branch node. Thanks for replying!

Ok, so ‘player’ is the correct type of variable, but it’s not assigned.

You need

image

somewhere ( or whatever your player type is ).

Thanks, I will try now!

OK so I put in the code, but Im still getting the same error message as before.

Err… you have to run the code

Begin play is not a bad idea…

Alright, that solves a few problems…now TWO of the FOUR ghosts will come out of the ghost base and go after the player, but the other two move like an inch to the middle of the base and stop. There was an error with the ghost moving to their first target point. I assume there is another null variable?

Here is the code for the second error:

Yes, it’s this variable

How are you setting it?

Like this, here is the other half of the code.

There’s one of your problems. If the length of an array is 3, the last index is 2. Best to change this

to

image

Alright I slotted that in, whats the next error?

Well, I don’t know, is it working? Are you getting errors?

The same error message is showing and the ghosts are moving back to the base whenever I eat a power pellet

Ok, show me where you’re calling the function ‘navigation wander’

BTW: the array thing was ok. I didn’t know the ‘random int’ node only goes up to max - 1…

Ok, thanks. But what I mean is, do you have that whole thing on tick, perhaps?

Maybe try waiting for about 1/2 second on begin play, before doing all of this…

Where would I check if it is on tick?

You’d know if it was… It’s not easy to troubleshoot ‘none’ errors remotely.

What I’d say is, start to understand what exactly that error is saying. Because you’re going to be getting it a lot until then.

It’s no good making a variable of the correct type, it has to actually point at something.

If it’s a player variable, it has to say which player. If it’s a blueprint var, it has to say which BP. If it’s a widget reference, it has to say which widget etc.